I have a MATLAB program written by one of my users which makes use of the SPM8 toolbox. If run directly, it works fine. However, when compiled and then run, the following error occurs:
Undefined function 'ft_datatype_sens' for input arguments of type 'struct'
This function comes from the Fieldtrip toolbox, which is bundled with the SPM8 toolbox. The startup.m
contains the following:
if(isdeployed==false)
addpath(genpath('/cm/shared/apps/matlab/spm/08'))
spm('defaults', 'eeg')
spm_get_defaults('cmdline',true)
disp('SPM path is set')
end
Not being a MATLAB user myself, I am groping in the dark, but my assumption is that the Fieldtrip toolbox is not being found.
Can anyone shed any light on this?
The solution is that the necessary directories need to be explicitly given via the option -I
:
mcc -C -mv -R -singleCompThread -R -nodisplay -I /cm/shared/apps/matlab/spm/08/ -I /cm/shared/apps/matlab/spm/08/spm_orthviews -I /cm/shared/apps/matlab/spm/08/config -I /cm/shared/apps/matlab/spm/08/matlabbatch -I /cm/shared/apps/matlab/spm/08/matlabbatch/cfg_confgui -I /cm/shared/apps/matlab/spm/08/matlabbatch/cfg_basicio -I /cm/shared/apps/matlab/spm/08/matlabbatch/cfg_basicio/src -I /cm/shared/apps/matlab/spm/08/matlabbatch/examples -I /cm/shared/apps/matlab/spm/08/src -I /cm/shared/apps/matlab/spm/08/toolbox -I /cm/shared/apps/matlab/spm/08/toolbox/mixture -I /cm/shared/apps/matlab/spm/08/toolbox/spectral -I /cm/shared/apps/matlab/spm/08/toolbox/Seg -I /cm/shared/apps/matlab/spm/08/toolbox/Beamforming -I /cm/shared/apps/matlab/spm/08/toolbox/DEM -I /cm/shared/apps/matlab/spm/08/toolbox/DARTEL -I /cm/shared/apps/matlab/spm/08/toolbox/MEEGtools -I /cm/shared/apps/matlab/spm/08/toolbox/Neural_Models -I /cm/shared/apps/matlab/spm/08/toolbox/dcm_meeg -I /cm/shared/apps/matlab/spm/08/toolbox/SRender -I /cm/shared/apps/matlab/spm/08/toolbox/Shoot -I /cm/shared/apps/matlab/spm/08/toolbox/HDW -I /cm/shared/apps/matlab/spm/08/toolbox/FieldMap -I /cm/shared/apps/matlab/spm/08/EEGtemplates -I /cm/shared/apps/matlab/spm/08/canonical -I /cm/shared/apps/matlab/spm/08/rend -I /cm/shared/apps/matlab/spm/08/apriori -I /cm/shared/apps/matlab/spm/08/templates -I /cm/shared/apps/matlab/spm/08/external -I /cm/shared/apps/matlab/spm/08/external/fieldtrip -I /cm/shared/apps/matlab/spm/08/external/fieldtrip/plotting -I /cm/shared/apps/matlab/spm/08/external/fieldtrip/fileio -I /cm/shared/apps/matlab/spm/08/external/fieldtrip/statfun -I /cm/shared/apps/matlab/spm/08/external/fieldtrip/src -I /cm/shared/apps/matlab/spm/08/external/fieldtrip/connectivity -I /cm/shared/apps/matlab/spm/08/external/fieldtrip/inverse -I /cm/shared/apps/matlab/spm/08/external/fieldtrip/specest -I /cm/shared/apps/matlab/spm/08/external/fieldtrip/forward -I /cm/shared/apps/matlab/spm/08/external/fieldtrip/utilities -I /cm/shared/apps/matlab/spm/08/external/fieldtrip/preproc -I /cm/shared/apps/matlab/spm/08/external/fieldtrip/trialfun -I /cm/shared/apps/matlab/spm/08/external/yokogawa -I /cm/shared/apps/matlab/spm/08/external/eeprobe -I /cm/shared/apps/matlab/spm/08/external/mne -I /cm/shared/apps/matlab/spm/08/external/ctf -I /cm/shared/apps/matlab/spm/08/external/bemcp -I /cm/shared/apps/matlab/spm/08/tpm myprog.m
It is probably possible to reduce the number of directories which need to be specified by using the option -a
, which can add directories recursively.