ChristianGaser / cat12

Computational Anatomy Toolbox for SPM12
https://neuro-jena.github.io/cat
GNU General Public License v2.0
32 stars 5 forks source link

cat_main_report error #24

Closed ThomasStephan1000 closed 3 months ago

ThomasStephan1000 commented 4 months ago

I use CAT12.9 to preprocess a dataset from Linux command line (matlab -batch). Processing does not generate the .pdf reports when used without GUI. I tried to re-generate these reports using cat_main_report, but run into an error:

>> job.files{1} = 'cat_sub-3556_ses-V06_I372345.xml'

job = 

  struct with fields:

    files: {'cat_sub-3556_ses-V06_I372345.xml'}

>> cat_main_report(job )
Index exceeds the number of array elements (0).

Error in cat_main_report (line 91)
    if isfield( job, 'Pp0' ) && iscell(job.Pp0) && ~isempty( job.Pp0{1} ) && ~isempty( job.Pp0{1} ) && exist( job.Pp0{fi} , 'file' )

Is this the right way to get the report, or am I doing something wrong?

Thank you for your support!

ThomasStephan1000 commented 4 months ago

I guess that I found the problem. In cat_main_report.m, change line 91:

%     if isfield( job, 'Pp0' ) && iscell(job.Pp0) && ~isempty( job.Pp0{1} ) && ~isempty( job.Pp0{1} ) && exist( job.Pp0{fi} , 'file' )
    if isfield( job, 'Pp0' ) && iscell(job.Pp0) && ~isempty( job.Pp0 ) && ~isempty( job.Pp0{1} ) && exist( job.Pp0{fi} , 'file' )

Expression 3 and 4 are identical, and they should not be. First test that Pp0 is not empty, and afterwards test for Pp0{1} to be present.

Best, Thomas