help > Error with task specification
Showing 1-11 of 11 posts
Display:
Results per page:
Feb 9, 2018  06:02 PM | Alex Rainer
Error with task specification
Hi Donald,

I have successfully used gPPI before so I thought I'd apply it to a new design. First, I ran into this error:

ERROR 1: Program will now exit. You specified too many tasks. Tasks must exist in all runs.
ERROR 2: PPPI inputs were specified correctly, but failed error checking for dependencies. See errorval{1}.
One or more inputs are not correct.
ERROR 1:Program will now exit. You specified too many tasks. Tasks must exist in all runs.
ERROR 2:PPPI inputs were specified correctly, but failed error checking for dependencies. See errorval{1}.
errorvals saved to errorvals.mat

One feature of my design is that I have a control run and 4 reward runs. The control run has 4 conditions (e.g., GS control, GE control, etc). The reward runs have 8 conditions (e.g., GS dollar, GE dollar, etc.). One of the contrasts I'm interested in is (GS dollar - GS control). Thus, when I got the error, I figured that was because I have conditions in the control run that are not in the reward runs and vice versa. To tackle this issue, I changed P.Tasks from:

{'1' 'GS_control' 'NGS_control' 'GS_dollar' 'NGS_dollar' 'GS_5cent' 'NGS_5cent'};

to

{'0' 'GS_control' 'NGS_control' 'GS_dollar' 'NGS_dollar' 'GS_5cent' 'NGS_5cent'};

Now I got this error:

VOI has 244 voxels in 3x3x3 space

VOI has 244 voxels in 3x3x3 space. This is in the the same space as the input data and functional mask.
Operands to the || and && operators must be convertible to logical scalar values.
Error in dlmwrite (line 133)
useVectorized = realdata && precnIsNumeric && ~contains('%\',dlm) ...
Error in PPPI (line 861)
dlmwrite([P.subject '_' region1 '_session' num2str(z) '_' P.method
'_PPI_regressors.txt'],[OUT.PPI.C OUT.P.C OUT.Y.C OUT.C.C],' ');
Error in gPPI_setup (line 84)
PPPI(P);

Could you please let me know why this is and/or how to solve this issue?

Thank you.

AR
Feb 9, 2018  07:02 PM | Donald McLaren
RE: Error with task specification
This seems to be a MATLAB issues with dlmwrite.

Are there multiple pathdef.m files?

>> which -all pathdef.m
The 'pathdef.m' that is currently used must be the one pertaining to the release of MATLAB you are using currently. If an older 'pathdef.m' exists, it will shadow the new one and does not add the directory to the path, which results in the error.
Renaming the old 'pathdef.m', if you have one, might fix the error.

Also, I assume you've already tried restarting the computer.
Feb 9, 2018  09:02 PM | Alex Rainer
RE: Error with task specification
Thanks for responding so quickly. There's only one pathdef.m. I've just tried restarting the computer but that did not fix the issue.

AR

Edit: I'm using R2017b MATLAB and SPM8.
Feb 9, 2018  09:02 PM | Donald McLaren
RE: Error with task specification
What happens with the following:
========================
P.Subject='testsubject'
z=1
P.method='PPI'
OUT.PPI.C=rand(100,5)
OUT.P.C=rand(100,5)
OUT.C.C=rand(100,5)
OUT.Y.C=rand(100,5)

dlmwrite([P.subject '_' region1 '_session' num2str(z) '_' P.method '_PPI_regressors.txt'],[OUT.PPI.C OUT.P.C OUT.Y.C OUT.C.C],' ');
========================


What is your P structure?
Feb 9, 2018  10:02 PM | Alex Rainer
RE: Error with task specification
When I ran that code, I got:

Operands to the || and && operators must be convertible to logical scalar values.

Error in dlmwrite (line 133)
useVectorized = realdata && precnIsNumeric && ~contains('%\',dlm) ...

And below is my P structure (attached file as well):

spmdir=fullfile(maindir,strcat('ALC_',subj{a},'_Onset_Model_withError'));
cd (spmdir);

% set up all parameters
P.equalroi=0; % this allows unequal sized VOIs
P.FLmask=1; % This allows VOIs to be trimmed by the 1st level mask
P.subject=char(subj{a}); % subject number
P.directory=pwd;
P.VOI=fullfile('/mnt/data/GNG_reward/ROIs/striatum/',sprintf('%s.nii',VOI{b}));
P.Region=VOI{b};
P.Estimate=1; % 1 means estimate PPI design
P.contrast=0;
P.extract='eig'; % extract eigenvariate
P.Tasks={'0' 'GS_control' 'NGS_control' ...
'GS_dollar' 'NGS_dollar' ...
'GS_5cent' 'NGS_5cent'}; % All events
P.Weights=[];
P.analysis='psy';
P.method='cond';
P.CompContrasts=1;
P.Weighted=0;
P.outdir=fullfile('/mnt/data/GNG_reward/gPPI/PPI_analysis/',subj{a},filesep);
P.GroupDir=fullfile('/mnt/data/GNG_reward/gPPI/Con_files/',subj{a},VOI{b},filesep);
% Contrast setup
P.Contrasts(1).left={'GS_5cent'};
P.Contrasts(1).right={'GS_control'};
P.Contrasts(1).STAT='T';
P.Contrasts(1).Weighted=0;
P.Contrasts(1).MinEvents=2;
P.Contrasts(1).name='GS_5cent_minus_GS_control';
Attachment: P.mat
Feb 9, 2018  11:02 PM | Donald McLaren
RE: Error with task specification
Good news, I've identified the MATLAB bug.

In line 133 of dlmwrite, change ~contains('%\',dlm) to isempty(strfind('%\',dlm)).

This should work.

I'm emailing Matlab with the issue to see if they have another work around.
Feb 10, 2018  07:02 PM | Alex Rainer
RE: Error with task specification
Yes, that fixes the issue. Thank you so much Donald!

AR
Feb 12, 2018  09:02 PM | Donald McLaren
RE: Error with task specification
Hi Alex,

It's not a matlab bug, but a conflict with contains.m, probably....

From MATLAB -- That is, "dlmwrite('myfilename.txt',rand(100,5))" does not result in an error. Furthermore, the output of "~contains('%\',dlm)" should be a logical 1 for both delimiters that you mentioned.

Would it be possible that you have another function called "contains"? You can check this easily by using the "which" command:
>> which contains
The result of this command is the file path for the function "contains" that is being called. Check to make sure the path is:
\toolbox\matlab\strfun\contains.m
Here, is the folder containing the program files for MATLAB on your machine. If this is not the path, then "dlmwrite" is calling the incorrect "contains" function. To correct this, please rename any other function called "contains".

If you contact MATLAB for further support, please provide them with the output of the following:
>> ver -support
>> which contains -all
Feb 16, 2018  10:02 PM | Alex Rainer
RE: Error with task specification
Hi Donald,

I've checked and there is one one contains.m and it resides where it should.

AR
Feb 16, 2018  11:02 PM | Donald McLaren
RE: Error with task specification
That's odd, but at least there is a work around, so everything is good.
Oct 15, 2018  06:10 PM | Akos Szekely
RE: Error with task specification
Hello,

I'm having the same issue, but unfortunately the previously-mentioned fix doesn't work for me.  I have MATLAB version R2017b, and from the moment I add gPPI to my path any use of a script or attempt to write a loop in the workspace yields continuous instances of "Operands to the || and && operators must be convertible to logical scalar values."  I attempted the basic example given earlier in this thread and I cannot run it.  Any use of dlmwrite finishes with an error and the same message, with no further explanation.  Even my attempts to diagnose the issue by including disp() commands in dlmwrite to view what is being fed into the command yield an error message.  I've looked into if pathdef.m, disp.m, contains.m, edit.m, and a few other files are shadowed, and a "which" call yields only a single instance for any/all of these, while "which -all" commands indicate that there are multiple same-named commands in different places associated with different methods.  I'm going to keep trying to figure this out, but I could really use some help

Best,
Akos Szekely