Hi Katie,
Have you tried launching SPM before running your script?
SPM does set up a few things to begin with, like adding path, checking toolboxes and initializing the matlabbatch tool.
See around line 333 and below in spm.m
Best,
Chris
Le 10/07/2014 00:37, Katie Surrence a écrit :
addpath('/home/katie/spm8/matlabbatch/@cfg_repeat')I also triedThanks for your help! I should have made said so, but I recognized it as what seemed like a path error, and I actually already tried explicitly addingto the script and I got the same error as above.
addpath('/home/katie/spm8/matlabbatch');
because @cfg_repeat is the directory with list.m, the program that seems to be at the root of the problem, and I got the same error, as well as this warning
Warning: Method directories not allowed in MATLAB path:
/home/katie/spm8/matlabbatch/@cfg_repeat
Maybe this is the problem? That this method directory is not allowed in the Matlab path? But if so how do I ever get that program to execute?
Here are all the SPM-relevant directories that are currently in my path:
MATLABPATH
/home/katie/spm8/matlabbatch/cfg_basicio
/home/katie/spm8/toolbox/vbm8
/home/katie/spm8/toolbox/Shoot
/home/katie/spm8/toolbox/DARTEL
/home/katie/spm8/toolbox/Seg
/home/katie/spm8/toolbox/FieldMap
/home/katie/spm8/config
/home/katie/spm8/matlabbatch
/home/katie/spm8
Best,
Katie
Best,
Katie
On Wed, Jul 9, 2014 at 6:04 PM, Dennis Thompson <[log in to unmask]> wrote:
When you see an error in Matlab referring to an "Undefined function", it often means that Matlab cannot find the function. This means that your Matlab paths are setup incorrectly.
For example when using spm8 this is my path.
/spm8_2013a/matlabbatch/cfg_basicio/spm8_2013a/toolbox/Shoot
/spm8_2013a/toolbox/DARTEL/spm8_2013a/toolbox/Seg/spm8_2013a/toolbox/FieldMap/spm8_2013a/config/spm8_2013a/matlabbatch/spm8_2013a
Of course everyone configuration will be a little different.
I suspect your path is missing spm8/matlabbatch.
Dennis
On Wed, Jul 9, 2014 at 2:48 PM, Katie Surrence <[log in to unmask]> wrote:
Dear SPM experts,I am new to batch programming. I am trying to write a short batch script to segment and skullstrip my data and I am getting an error:
______________________
Undefined function 'list' for input arguments of type 'cell'.
Error in cfg_repeat/list (line 112)
[id1 stop1] = list(citems{k}, spec, tropts);
Error in cfg_util>local_getcjid2subs (line 1196)
cjid2subsin = list(cjin, exspec, tropts);
Error in cfg_util>local_initjob (line 1367)
[ucj ucjid2subs] = cellfun(@local_getcjid2subs, ucj, 'UniformOutput',
false);
Error in cfg_util (line 678)
[jobs(cjob) mod_job_idlist] = local_initjob(jobs(cjob),
job, jobdedup);
Error in spm_jobman (line 216)
cjob = cfg_util('initjob', mljob);
Error in ks_seg_and_strip (line 77)
output = spm_jobman('run',matlabbatch);
_________________________
I am attaching my full script.
I found this discussion of the same error:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?A3=ind1305&L=SPM&E=quoted-printable&P=1000032&B=--Apple-Mail%3D_CC849512-9CAA-4FB8-86B8-B8A0FCE8F1F3&T=text%2Fhtml;%20charset=iso-8859-1&pending=
https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=spm;2620fbcc.1305
but I didn't quite understand what the solution was. I did try moving my SPM installation in case it would help, but it didn't. I have another batch script to run just realignment that works without issue, and it's set up very similarly.
I'm having trouble wrapping my mind around the fact that it's a path issue but the error reports quote from inside the function that it says is undefined.
I would appreciate any insight you can provide.
Best,
Katie