You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: MS_rotEuler.m
    path of file: ./repos/MSAT/msat
    
    the code of the file until where you have to start completion: % MS_ROTEULER - Rotate an elasticity matrix using Bunge's Euler angles.
%
% // Part of MSAT - The Matlab Seismic Anisotropy Toolkit //
%
% Rotate one or more elasticity matrices using Bunge's Euler angles 
%
% Usage:
%
%    [ C
    
function [ CC ] = rot_Euler_scalar(C, phi1, theta, phi2, transpose)
    
    %FIXME - delegate this text to MS_rotR?
    assert(MS_checkC(C)==1, 'MS:Cinvalid', ...
        'Argument "C" must be a valid 6x6 elasticity matrix');
    
    % Pre-compute trig functions.
    cp1 = cos(phi1);
    sp1 = sin(phi1);
    cp2 = cos(phi2);
    sp2 = sin(phi2);
    cth = cos(theta);
    sth = sin(theta);

    % Form rotation matrix for Bunge convention of 
    % Euler angles, see eq 24 (pg81) of "Preferred
    % orientation in deformed meals and rocks... H-K Wenk (ed)"
    % Note that this is for the passive roation.
    g = [cp1*cp2 - sp1*sp2*cth, sp1*cp2 + cp1*sp2*cth, sp2*sth ; ...
        -1*cp1*sp2 - sp1*cp2*cth, -1*sp1*sp2 + cp1*cp2*cth, cp2*sth; ...
        sp1*sth, -1*cp1*sth, cth];
    
    if transpose
        % Active rotation
        CC = MS_rotR(C, g');
    else
        % Passive rotation
        CC = MS_rotR(C, g);
    end