I tried to use a private MATLAB function (private means that I wrote it myself) via the matlabbatch object in SPM12 that I compiled :
run_spm12.sh $MCR_ENV run batch.m
with the batch.m file containing the following lines:
matlabbatch{1}.cfg_basicio.run_ops.call_matlab.inputs{1}.string = 'Hello world';
matlabbatch{1}.cfg_basicio.run_ops.call_matlab.outputs = {};
matlabbatch{1}.cfg_basicio.run_ops.call_matlab.fun = 'myfunction';
with the function 'myfunction' defined in the file myfunction.m as:
function myfunction(n)
disp(n);
end
The error message returned by SPM is the following:
Item 'Function to be called', field 'val': Item must be a function handle or function name.
However, it works if i replace the function 'myfunction' by a standard MATLAB function, such as 'disp' for instance. It suggests that, somehow, I need to specify the path to the myfunction.m file but I did not find out how.
Thanks for your help.