help > Error: "Input structure is not correct"
Showing 1-8 of 8 posts
Display:
Results per page:
Jan 20, 2015  03:01 PM | Emily Jacobs - Harvard Medical School
Error: "Input structure is not correct"
Hi Dr. McLaren,

I'm running a pretty straightforward analysis looking at the change in effective connectivity between a seed (dorsolateral PFC, defined functionally from the group level contrast) and the rest of brain as a function of working memory load (low vs high). I'm running a gPPI analysis using the following script (copied at the bottom). The script has worked beautifully on 120 of 140 subjects. For the successful subjects the results look reasonable - showing greater connectivity between DLPFC and posterior parietal cortices as working memory load increases.

For 20 subjects, the script failed and I got the following error:
"Input structure is not correct."

There is nothing obviously different between the subjects who ran successfully and those who didn't (e.g. no difference in path structure, etc).

Any inkling what the problem could be?

Very grateful for your time,

Emily

--------------------------------------------------------------------------------------------

clear all
clc
%%%Change this if changing the seed
P.VOI='/autofs/space/lobulus_002/users/NEFS_aging/2back_N142/_PPI/Seed_ROIs/ROI_14_masked.nii';
P.Region='L_DLPFC';

%P.equalroi = 0;
%%%Creating a group folder
RegionName=evalc('P.Region');

%IMPORTANT!!! - The length of RegionName may change for different lengths of seed names
%for B_Nacc RegionName(9:14) %for B_Habenula RegionName(9:18) %for B_Caduate RegionName(9:17)
P.GroupDir=['/autofs/space/lobulus_002/users/NEFS_aging/2back_N142/_PPI/Group_Analyses/', RegionName(9:15)];
Group_Dir = P.GroupDir;
if ~exist(Group_Dir, 'dir'),
mkdir(Group_Dir);
end

%%%Subject list
Subjects={'B12871-ef'};

%%%Those are all PPI related variables that are identical for all subjects
P.Estimate=1;
P.contrast=0;
P.extract='eig';
P.Tasks={'1' '2back' 'XTask'};
P.Weights=[];
P.method='cond';
P.analysis='psy';
P.CompContrasts=1;
P.Weighted=0;

%%%Loop between subjects
for i=1:length (Subjects);
SubjName = evalc('Subjects(i)');
P.subject=SubjName(15:23);
P.directory=['/autofs/space/lobulus_002/users/NEFS_aging/',SubjName(15:23),'/nifti/2back/2back_motionmodel']
try

%&&Directory of SPM.mat files
SPM_Dir=P.directory;
cd(SPM_Dir);
%%%Do the gPPI
PPPI(P);
catch
disp(['Failed: ' Subjects{i}])
end
end
Jan 20, 2015  03:01 PM | Donald McLaren
Error: "Input structure is not correct"
It's hard to debug from the information provided. The try/catch statement
works well for looping through things that might fail and not being held
up. However, it makes debugging very difficult.

If you could re-run a few of the problematic subjects, without the
try/catch statement, then more information should be provided about where
the error is occurring.

Please repost with additional errors.
Jan 20, 2015  04:01 PM | Emily Jacobs - Harvard Medical School
RE: Error: "Input structure is not correct"
Darn, I removed the try/catch statement and ran a few of problematic subjects one at a time and received the same error: "Program will exit. Input structure is not correct."
Jan 20, 2015  04:01 PM | Emily Jacobs - Harvard Medical School
RE: Error: "Input structure is not correct"
P =

VOI: '/autofs/space/lobulus_002/users/NEFS_aging/2back_N142/_PPI/Seed_ROIs/ROI_12_masked.nii'
Region: 'L_DLPFC_2'
GroupDir: '/autofs/space/lobulus_002/users/NEFS_aging/2back_N142/_PPI/Group_Analyses/L_DLPFC_2'
Estimate: 1
contrast: 0
extract: 'eig'
Tasks: {'1' '2back' 'XTask'}
Weights: []
method: 'cond'
analysis: 'psy'
CompContrasts: 1
Weighted: 0
subject: 'B12871-ef'
directory: '/autofs/space/lobulus_002/users/NEFS_aging/B12871-ef/nifti/2back/2back_motionmodel'

Program will exit. Input structure is not correct.
Jan 20, 2015  05:01 PM | Donald McLaren
RE: Error: "Input structure is not correct"
After you create/load/modify P, can you use the command:
[P, errorval]=PPPI_checkstruct(P)

To stop the program, you can insert the word keyboard on the line before
you want the program to stop. This way, you can stop right before the PPPI
line and run the above command instead. This should produce a more detailed
message about why the program is failing.

If you get an error about Contrasts field not existing, then the likely
source is that defContrasts.m isn't in the matlab path.

If you type:
which defContrasts.m

What is the output?

Once you have added it to the path, then everything should work.

Hope this helps.
Jan 20, 2015  05:01 PM | Emily Jacobs - Harvard Medical School
RE: Error: "Input structure is not correct"
Really can't thank you enough for your brainpower on this. 

Here's what I got: 

K>> [P, errorval]=PPPI_checkstruct(P)
??? Error using ==> save
Unable to write file /autofs/space/lobulus_002/users/NEFS_aging/B12871-ef/nifti/2back/2back_motionmodel/invalidPPIstructure.mat: permission denied.

Error in ==> PPPI_checkstruct at 711
save([pwd filesep 'invalidPPIstructure.mat'],'P');
Jan 20, 2015  07:01 PM | Donald McLaren
RE: Error: "Input structure is not correct"
This means that you do not have permission to write to this directory.
Please check the file permissions of the directory and make sure you have
write permission in the directory.
Jan 21, 2015  03:01 PM | Emily Jacobs - Harvard Medical School
RE: Error: "Input structure is not correct"
apologies - problem solved.