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: SHInfo2Vec.m
    path of file: ./repos/HRTF-Individualization/model/matlabcode/functions/sh/shtools
    
    the code of the file until where you have to start completion: function [vec,lmax] = SHInfo2Vec(lmcosi)

% [vec,lmax] = SHInfo2Vec(lmcosi)
%
% The input coefficient structure
% lmcosi in the format [l m Ccos Csin] in order, m>=0.

    
function [vec,lmax] = SHInfo2Vec(lmcosi)

% [vec,lmax] = SHInfo2Vec(lmcosi)
%
% The input coefficient structure
% lmcosi in the format [l m Ccos Csin] in order, m>=0.
% This format is provided by plm2rot and other functions
% of the library DOTM by F. J. Simons
% Outputs the real spherical harmonic coefficient vector.
 
lmax = lmcosi(end