help > RE: Error importing SPM.mat file
Nov 26, 2014  02:11 AM | Alfonso Nieto-Castanon - Boston University
RE: Error importing SPM.mat file
Dear Xiaozhen,

The most likely reason for this error would be if you forgot to include a batch.filename and/or a batch.isnew fields in your batch structure. When you do not specify an filename for your project CONN assumes that you want to work on the currently-active project (that loaded in the CONN gui), and the error that you are getting seems to indicate that you do not have the GUI open. If you want to create a new project (e.g. named conn_myproject.mat) simply add the following fields to your batch script when defining your batch structure:

  batch.filename = 'conn_myproject.mat';
  batch.Setup.isnew = true;

Hope this helps (if this does not seem to be the issue please send or post the relevant portions of your batch script to more easily identify the problem)
Alfonso

Originally posted by Xiaozhen You:
Dear experts,
I'm encountering the error during the Setup using SPM.mat files in batch. and I did some debugging, seems conn_importspm goes before assigning other Setup info to the global variable CONN_x. Wonder how to fix this.
Also if I have 2 different tasks within subjects, thus with 2 different SPM.mat file, can I also setup the spmfiles as spmfiles{nsub}{nsession} for conn_batch to automatically recognize the conditions etc?
Thanks!
Xiaozhen

"Reference to non-existent field 'Setup'.

Error in conn_importspm (line 9)
if nsubjects~=CONN_x.Setup.nsubjects,
CONN_x.Setup.nsubjects=conn_merge(CONN_x.Setup.nsubjects,nsubjects); end
Error in conn_batch (line 242)
conn_importspm(batch.Setup.spmfiles);
Error in BatchScript_withexcel_Connallfields_spm (line 188)
conn_batch(batch);"






if isfield(batch.Setup,'spmfiles')&&~isempty(batch.Setup.spmfiles),
        CONN_x.gui=struct('overwrite',batch.Setup.overwrite);
        conn_importspm(batch.Setup.spmfiles);
        CONN_x.gui=1;
    end
    if isfield(batch.Setup,'RT')&&~isempty(batch.Setup.RT),CONN_x.Setup.RT=batch.Setup.RT;end
    if isfield(batch.Setup,'nsubjects')&&~isempty(batch.Setup.nsubjects),
        if batch.Setup.nsubjects~=CONN_x.Setup.nsubjects, CONN_x.Setup.nsubjects=conn_merge(CONN_x.Setup.nsubjects,batch.Setup.nsubjects); end
%         CONN_x.Setup.nsubjects=batch.Setup.nsubjects;     % number of subjects
    end

Threaded View

TitleAuthorDate
Xiaozhen You Nov 25, 2014
Xiaozhen You Nov 26, 2014
Alfonso Nieto-Castanon Nov 27, 2014
Xiaozhen You Dec 9, 2014
Alfonso Nieto-Castanon Dec 10, 2014
Alfonso Nieto-Castanon Dec 10, 2014
Xiaozhen You Dec 10, 2014
Alfonso Nieto-Castanon Dec 12, 2014
Xiaozhen You Dec 23, 2014
Xiaozhen You Dec 23, 2014
Alfonso Nieto-Castanon Dec 24, 2014
Xiaozhen You Dec 31, 2014
Alfonso Nieto-Castanon Dec 31, 2014
Xiaozhen You Jan 1, 2015
Alfonso Nieto-Castanon Jan 1, 2015
Xiaozhen You Jan 2, 2015
Alfonso Nieto-Castanon Jan 3, 2015
Xiaozhen You Jan 5, 2015
Xiaozhen You Jan 6, 2015
Alfonso Nieto-Castanon Jan 15, 2015
Xiaozhen You Jan 15, 2015
Xiaozhen You Dec 17, 2014
Xiaozhen You Nov 27, 2014
RE: Error importing SPM.mat file
Alfonso Nieto-Castanon Nov 26, 2014