Print

Print


Thanks, Chris!

I do launch SPM before running my script.  As it happens, though, I now I have the solution, sent directly to me (not to the list).  I'll leave it here in case someone else ever has this error.  

I replaced this line:

matlabbatch{1}.util{1}.cdir.directory =
cellstr(fullfile(data_path,subjects{i}));

with this

matlabbatch{1}.cfg_basicio.cfg_cd.dir =
cellstr(fullfile(data_path,subjects{i}));

and the script now works.  

Thanks all for your help.  

Best,
Katie



On Thu, Jul 10, 2014 at 5:11 AM, Christophe Phillips <[log in to unmask]> wrote:

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 :
Thanks 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 adding

addpath('/home/katie/spm8/matlabbatch');

to the script and I got the same error as above.   

I also tried

addpath('/home/katie/spm8/matlabbatch/@cfg_repeat')

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. 

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