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_project.m
    path of file: ./repos/ExploreASL/External/SPMmodified
    
    the code of the file until where you have to start completion: function P = spm_mesh_project(M, dat, method, varargin)
% Project volumetric data onto a mesh

    
function P = spm_mesh_project(M, dat, method, varargin)
% Project volumetric data onto a mesh
% FORMAT P = spm_mesh_project(M, dat, method)
% M        - a patch structure, a handle to a patch 
%            or a [nx3] vertices array
% dat      - a structure array [1xm] with fields dim, mat, XYZ and t 
%            (see spm_rend