Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Illegal use of reserved keyword "if".
Replies: 3   Last Post: Aug 20, 2013 3:09 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Bluemath

Posts: 2
Registered: 8/20/13
Re: Illegal use of reserved keyword "if".
Posted: Aug 20, 2013 1:19 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Steven_Lord" <slord@mathworks.com> wrote in message <kv04s2$iqg$1@newscl01ah.mathworks.com>...
>
>
> "Bluemath " <luciana.falbo@gmail.com> wrote in message
> news:kuvtvi$h43$1@newscl01ah.mathworks.com...

> > I created several cases based on a pre-existing script. For one of those I
> > copied the following:
> >
> > if ~ERRORS, n_cnames = n_cnames(1:size(n_cnames,1)-1, :);
> > sel_cond = sel_cond(1:1:numel(sel_cond)-1);
> > end
> >
> > (it is perfectly working for other cases, but when I switch to the last
> > one it gives the following errors 'Illegal use of the reserved keyword
> > "if"' and 'Invalid syntax of IF. Possibly a ),} or ] are missing'

>
> So what does "the last one" look like?
>
> --
> Steve Lord


Hi Steve,

Thanks for offering your help. I think this is the part that creates issues:


if nargin<4
dir = '';
filestobeanalyzed = '';

%task = 'gambling';
%task = 'gonogo';
task = 'memory';


ERRORS = 1; % Include error trials in the design ('1') or not ('0').
end
RESPONSE = 0; % Include RESPONSES in the design ('1') or not ('0').

%XXXXXXXXXX END OF Session specific vartiables XXXXXXXXXXXXXXXXXXXXXXXXXXXX

% Notes.
%-------




%XXXXXXXXXX END OF Notes section XXXXXXXXXXXXXXXXXXXXXXXXXXXX

%% parameters for the excel script that writes the mean data for each
%% subject

% write_mean = 'no'; %'yes' or 'no', if 'no' the mean data are
% % not added to the total file
% meanfilename = 'test switch.xls';
% % filename were mean results are saved if
% % write_mean = 'yes'. For the swithing task
% % results are written in a txt-file, if not
% % specified here it is altered lateron
select4spm = 1; % Create new files with only a selection of
% the conditions
LogExt = '.log'; % extention that marks a log-file
%LogExt = '.xls'; % extention that marks a log-file
LogExt = filestobeanalyzed;


%% parameters to search for in the logfile, according to right of left
%% needed answer
%% if not applicable in the present task fill in 'a word that not exists in the logfile'. e.g., Cleft = str2mat ('bikini')

switch task

case 'memory'
%15. memory taks, experiment 2
%--------------------------------------------------------------------------

Ctarget = str2mat(...
'AG_E1_Low', 'AG_E1_High', 'AG_E2_Low', 'AG_E2_High', 'AG_DE_Low', 'AG_DE_High', 'AG_D_Low', 'AG_D_High', ...
'Enc_E1_Low', 'Enc_E1_High', 'Enc_E2_Low', 'Enc_E2_High', 'Enc_DE_Low', 'Enc_DE_High', 'Enc_D_Low', 'Enc_D_High', ...
'Movie');
Ctarget_ = Ctarget;
Cresponse = str2mat('hit', 'miss', 'other'); % hit, false alarm, incorrect, miss
Cresponse_ = str2mat('hit', 'miss', 'other'); % hit, false_alarm, incorrect, miss - has to be double to file with _ because spaces are not good in matlab :)

end % end of switch


case 'memory'

%--------------------------------------------------------------------------
sel_cond = {...
{'AG_E1_Low_other'},...
{'AG_E1_High_other'},...
{'AG_E2_Low_other'},...
{'AG_E2_High_other'},...
{'AG_DE_Low_other'},...
{'AG_DE_High_other'},...
{'AG_D_Low_other'},...
{'AG_D_High_other'}, ...
{'Enc_E1_Low_other'},...
{'Enc_E1_High_other'},...
{'Enc_E2_Low_other'},...
{'Enc_E2_High_other'},...
{'Enc_DE_Low_other'},...
{'Enc_DE_High_other'},...
{'Enc_D_Low_other'},...
{'Enc_D_High_other', ...
{'Movie_other'},...
{'AG_E1_Low_hit'}, ...
{'AG_E1_High_hit'}, ...
{'AG_E2_Low_hit'}, ...
{'AG_E2_High_hit'}, ...
{'AG_DE_Low_hit'}, ...
{'AG_DE_High_hit'}, ...
{'AG_D_Low_hit'}, ...
{'AG_D_High_hit'}, ...
{'Enc_E1_Low_hit'}, ...
{'Enc_E1_High_hit'}, ...
{'Enc_E2_Low_hit'}, ...
{'Enc_E2_High_hit'}, ...
{'Enc_DE_Low_hit'}, ...
{'Enc_DE_High_hit'}, ...
{'Enc_D_Low_hit'}, ...
{'Enc_D_High_hit'}, ...
{'Movie_hit'}, ...
{'AG_E1_Low_miss'}, ...
{'AG_E1_High_miss'}, ...
{'AG_E2_Low_miss'}, ...
{'AG_E2_High_miss'}, ...
{'AG_DE_Low_miss'}, ...
{'AG_DE_High_miss'}, ...
{'AG_D_Low_miss'}, ...
{'AG_D_High_miss'}, ...
{'Enc_E1_High_miss'}, ...
{'Enc_E2_Low_miss'}, ...
{'Enc_E2_High_miss'}, ...
{'Enc_DE_Low_miss'}, ...
{'Enc_DE_High_miss'}, ...
{'Enc_D_Low_miss'}, ...
{'Enc_D_High_miss'}, ...
{'Movie_miss'};


n_cnames == str2mat('AG_E1_Low', ...
'AG_E1_High', ...
'AG_E2_Low', ...
'AG_E2_High', ...
'AG_DE_Low', ...
'AG_DE_High', ...
'AG_D_Low', ...
'AG_D_High', ...
'Enc_E1_Low', ...
'Enc_E1_High', ...
'Enc_E2_Low', ...
'Enc_E2_High', ...
'Enc_DE_Low', ...
'Enc_DE_High', ...
'Enc_D_Low', ...
'Enc_D_High', ...
'Movie');

if ~ERRORS,
n_cnames = n_cnames(1:size(n_cnames,1)-1, :);
sel_cond = sel_cond([1:1:numel(sel_cond)-1]);
end

% Run the selection routine
[nme, on, dur] = lnp_selectcond4spm_select(condition_names, on, dur, rt, sel_cond, n_cnames, filenameTO, filenameCN, filenameRT);

% Save in SPM05 jobmanager compatible structure
onsetfiles{i} = Save_SPM5_Comp(nme, on, dur, dir, logfn);

The last "if" is were the problem occurs.

Hope you can see better what I did wrong.

Regards,
Lucy

> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.