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: spm_mesh_join.m
    path of file: ./repos/bspm/thirdparty/spm12
    
    the code of the file until where you have to start completion: function M = spm_mesh_join(Ms)
% Join a list of surface meshes into a single one
% FORMAT M = spm_mesh_join(Ms)
% Ms       - a patch structure array
%
% M        - a patch structure
%
% See also spm_mesh_split
%__________________________________________________________________________
% Copyright (C) 2016 Wellcome Trust Centre for Neuroimaging

% Guillaume Flandin
% $Id: spm_mesh_join.m 6912 2016-10-26 14:50:53Z guillaume $


fn = fieldnames(Ms(1));
M  = cell2struct(cell(numel(fn),1),fn);


    
function M = spm_mesh_join(Ms)
% Join a list of surface meshes into a single one
% FORMAT M = spm_mesh_join(Ms)
% Ms       - a patch structure array
%
% M        - a patch structure
%
% See also spm_mesh_split
%__________________________________________________________________________
% Copyright (C) 2016 Wellcome Trust Centre for Neuroimaging

% Guillaume Flandin
% $Id: spm_mesh_join.m 6912 2016-10-26 14:50:53Z guillaume $


fn = fieldnames(Ms(1));
M  = cell2struct(cell(numel(fn),1),fn);

for i=1:numel(Ms)
    if i==1
        M.faces   = Ms(i).faces;
    else
        M.faces   = [M.faces; Ms(i).faces+size(M.vertices,1)];
    end