error message: Unmatched parenthesis


Author
Message
franziska.motka
franziska.motka
New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)
Group: Forum Members
Posts: 3, Visits: 4
Hi everyone,

we want to run a Stop-Signal-Task (SST). Unfortunately, we get an error message for the following line:
iscorrectresponse = [(values.expcondition == 1 && if(values.stimulus=40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey) ||
                        (values.expcondition == 2 && if(values.stimulus40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey)]

Expression ' if (values.stimulus<=90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)||(values.expcondition==2&& if (values.stimulus>90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)' is invalid. Unmatched parenthesis.

We would appreciate any help!

Best,
Franziska Motka
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
franziska.motka - 9/20/2022
Hi everyone,

we want to run a Stop-Signal-Task (SST). Unfortunately, we get an error message for the following line:
iscorrectresponse = [(values.expcondition == 1 && if(values.stimulus=40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey) ||
                        (values.expcondition == 2 && if(values.stimulus40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey)]

Expression ' if (values.stimulus<=90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)||(values.expcondition==2&& if (values.stimulus>90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)' is invalid. Unmatched parenthesis.

We would appreciate any help!

Best,
Franziska Motka

(1) The line

iscorrectresponse = [(values.expcondition == 1 && if(values.stimulus=40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey) ||
(values.expcondition == 2 && if(values.stimulus40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey)]


is not what the error message references.

Expression ' if (values.stimulus<=90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)||(values.expcondition==2&& if (values.stimulus>90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)' is invalid. Unmatched parenthesis.


(2) Providing a single, isolated line of code is not useful. Provide the actual script including any and all files the script requires to run.

(3) Please make sure your code is properly documented, i.e. comments should explain clearly and precisely what the given code is intended to do. This is especially important because there are multiple syntax issues even in the single line you posted. It's not self-evident what this code is supposed to do.

franziska.motka
franziska.motka
New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)
Group: Forum Members
Posts: 3, Visits: 4
Dave - 9/20/2022
franziska.motka - 9/20/2022
Hi everyone,

we want to run a Stop-Signal-Task (SST). Unfortunately, we get an error message for the following line:
iscorrectresponse = [(values.expcondition == 1 && if(values.stimulus=40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey) ||
                        (values.expcondition == 2 && if(values.stimulus40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey)]

Expression ' if (values.stimulus<=90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)||(values.expcondition==2&& if (values.stimulus>90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)' is invalid. Unmatched parenthesis.

We would appreciate any help!

Best,
Franziska Motka

(1) The line

iscorrectresponse = [(values.expcondition == 1 && if(values.stimulus=40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey) ||
(values.expcondition == 2 && if(values.stimulus40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey)]


is not what the error message references.

Expression ' if (values.stimulus<=90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)||(values.expcondition==2&& if (values.stimulus>90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)' is invalid. Unmatched parenthesis.


(2) Providing a single, isolated line of code is not useful. Provide the actual script including any and all files the script requires to run.

(3) Please make sure your code is properly documented, i.e. comments should explain clearly and precisely what the given code is intended to do. This is especially important because there are multiple syntax issues even in the single line you posted. It's not self-evident what this code is supposed to do.

Thank you for your answer and sorry for the mistake. Here is the proper code:
***********************************************************************************************************************************************************************
    No-Signal-Trial
***********************************************************************************************************************************************************************
***********************************************************************************************************************************************************************
<trial nstrial>
/ ontrialbegin = [values.stimulus=list.ns_stims.nextvalue; values.signal=0; values.trialnumber+=1; values.ssd=0]
/ ontrialend = [if(trial.nstrial.correct==1)values.correct=2 else values.correct=0]
/ ontrialend = [if(trial.nstrial.response==0)values.rt=0 else values.rt=trial.nstrial.latency]
/ ontrialend = [if(trial.nstrial.response!=0){
    values.ns_rtsum=values.ns_rtsum+values.rt; values.ns_nresp+=1}]
/ ontrialend = [if(trial.nstrial.response==0)values.ns_nnoresp+=1]
/ ontrialend = [if(expressions.trialnumber!=0)values.raw_rtsum=values.raw_rtsum+values.rt]
/ ontrialend = [if(expressions.trialnumber!=0)values.ns_ntotal+=1]
/ ontrialend = [if(expressions.trialnumber!=0 && trial.nstrial.response==0)values.ns_nmiss+=1]
/ ontrialend = [if(values.correct==2 && expressions.trialnumber!=0){
    values.ns_ncorr+=1; values.ns_rtcorrsum=values.ns_rtcorrsum+values.rt}]
/ ontrialend = [if(trial.nstrial.response==values.leftkey)values.response=1]
/ ontrialend = [if(trial.nstrial.response==values.rightkey)values.response=2]
/ ontrialend = [if(trial.nstrial.response==0)values.response=0]
/ stimulustimes = [0=fixation; 250=stim; 1500=erasestim]
/ responsetime = 250
/ pretrialpause = values.pretrialpause
/ posttrialpause = values.posttrialpause
/ trialduration = values.trialduration
/ responseinterrupt = frames
/ isvalidresponse = [trial.nstrial.response==0||trial.nstrial.response==values.leftkey||trial.nstrial.response==values.rightkey]
/ iscorrectresponse = [(values.expcondition == 1 && if(values.stimulus<=40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey) ||
                        (values.expcondition == 2 && if(values.stimulus>40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey)]
/ monkeyresponse = (values.leftkey, values.rightkey)
</trial>

/ iscorrectresponse = [(values.expcondition == 1 && trial.practicetrial_a.responsey < values.mouse_y) ||
                        (values.expcondition == 2 && trial.practicetrial_a.responsey > values.mouse_y)]

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
franziska.motka - 9/20/2022
Dave - 9/20/2022
franziska.motka - 9/20/2022
Hi everyone,

we want to run a Stop-Signal-Task (SST). Unfortunately, we get an error message for the following line:
iscorrectresponse = [(values.expcondition == 1 && if(values.stimulus=40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey) ||
                        (values.expcondition == 2 && if(values.stimulus40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey)]

Expression ' if (values.stimulus<=90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)||(values.expcondition==2&& if (values.stimulus>90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)' is invalid. Unmatched parenthesis.

We would appreciate any help!

Best,
Franziska Motka

(1) The line

iscorrectresponse = [(values.expcondition == 1 && if(values.stimulus=40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey) ||
(values.expcondition == 2 && if(values.stimulus40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey)]


is not what the error message references.

Expression ' if (values.stimulus<=90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)||(values.expcondition==2&& if (values.stimulus>90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)' is invalid. Unmatched parenthesis.


(2) Providing a single, isolated line of code is not useful. Provide the actual script including any and all files the script requires to run.

(3) Please make sure your code is properly documented, i.e. comments should explain clearly and precisely what the given code is intended to do. This is especially important because there are multiple syntax issues even in the single line you posted. It's not self-evident what this code is supposed to do.

Thank you for your answer and sorry for the mistake. Here is the proper code:
***********************************************************************************************************************************************************************
    No-Signal-Trial
***********************************************************************************************************************************************************************
***********************************************************************************************************************************************************************
<trial nstrial>
/ ontrialbegin = [values.stimulus=list.ns_stims.nextvalue; values.signal=0; values.trialnumber+=1; values.ssd=0]
/ ontrialend = [if(trial.nstrial.correct==1)values.correct=2 else values.correct=0]
/ ontrialend = [if(trial.nstrial.response==0)values.rt=0 else values.rt=trial.nstrial.latency]
/ ontrialend = [if(trial.nstrial.response!=0){
    values.ns_rtsum=values.ns_rtsum+values.rt; values.ns_nresp+=1}]
/ ontrialend = [if(trial.nstrial.response==0)values.ns_nnoresp+=1]
/ ontrialend = [if(expressions.trialnumber!=0)values.raw_rtsum=values.raw_rtsum+values.rt]
/ ontrialend = [if(expressions.trialnumber!=0)values.ns_ntotal+=1]
/ ontrialend = [if(expressions.trialnumber!=0 && trial.nstrial.response==0)values.ns_nmiss+=1]
/ ontrialend = [if(values.correct==2 && expressions.trialnumber!=0){
    values.ns_ncorr+=1; values.ns_rtcorrsum=values.ns_rtcorrsum+values.rt}]
/ ontrialend = [if(trial.nstrial.response==values.leftkey)values.response=1]
/ ontrialend = [if(trial.nstrial.response==values.rightkey)values.response=2]
/ ontrialend = [if(trial.nstrial.response==0)values.response=0]
/ stimulustimes = [0=fixation; 250=stim; 1500=erasestim]
/ responsetime = 250
/ pretrialpause = values.pretrialpause
/ posttrialpause = values.posttrialpause
/ trialduration = values.trialduration
/ responseinterrupt = frames
/ isvalidresponse = [trial.nstrial.response==0||trial.nstrial.response==values.leftkey||trial.nstrial.response==values.rightkey]
/ iscorrectresponse = [(values.expcondition == 1 && if(values.stimulus<=40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey) ||
                        (values.expcondition == 2 && if(values.stimulus>40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey)]
/ monkeyresponse = (values.leftkey, values.rightkey)
</trial>

/ iscorrectresponse = [(values.expcondition == 1 && trial.practicetrial_a.responsey < values.mouse_y) ||
                        (values.expcondition == 2 && trial.practicetrial_a.responsey > values.mouse_y)]

I asked you to provide the full script and all files it requires to run. I also asked you to explain what the faulty code is actually intended to do.

Code for a single <trial> element from the script is not responsive to either of these requests and does not enable me to tell you (a) what's wrong with your code and (b) how to fix it.

Please provide the information and materials I asked for. Thank you.

franziska.motka
franziska.motka
New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)New Member (31 reputation)
Group: Forum Members
Posts: 3, Visits: 4
Dave - 9/20/2022
franziska.motka - 9/20/2022
Dave - 9/20/2022
franziska.motka - 9/20/2022
Hi everyone,

we want to run a Stop-Signal-Task (SST). Unfortunately, we get an error message for the following line:
iscorrectresponse = [(values.expcondition == 1 && if(values.stimulus=40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey) ||
                        (values.expcondition == 2 && if(values.stimulus40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey)]

Expression ' if (values.stimulus<=90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)||(values.expcondition==2&& if (values.stimulus>90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)' is invalid. Unmatched parenthesis.

We would appreciate any help!

Best,
Franziska Motka

(1) The line

iscorrectresponse = [(values.expcondition == 1 && if(values.stimulus=40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey) ||
(values.expcondition == 2 && if(values.stimulus40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey)]


is not what the error message references.

Expression ' if (values.stimulus<=90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)||(values.expcondition==2&& if (values.stimulus>90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)' is invalid. Unmatched parenthesis.


(2) Providing a single, isolated line of code is not useful. Provide the actual script including any and all files the script requires to run.

(3) Please make sure your code is properly documented, i.e. comments should explain clearly and precisely what the given code is intended to do. This is especially important because there are multiple syntax issues even in the single line you posted. It's not self-evident what this code is supposed to do.

Thank you for your answer and sorry for the mistake. Here is the proper code:
***********************************************************************************************************************************************************************
    No-Signal-Trial
***********************************************************************************************************************************************************************
***********************************************************************************************************************************************************************
<trial nstrial>
/ ontrialbegin = [values.stimulus=list.ns_stims.nextvalue; values.signal=0; values.trialnumber+=1; values.ssd=0]
/ ontrialend = [if(trial.nstrial.correct==1)values.correct=2 else values.correct=0]
/ ontrialend = [if(trial.nstrial.response==0)values.rt=0 else values.rt=trial.nstrial.latency]
/ ontrialend = [if(trial.nstrial.response!=0){
    values.ns_rtsum=values.ns_rtsum+values.rt; values.ns_nresp+=1}]
/ ontrialend = [if(trial.nstrial.response==0)values.ns_nnoresp+=1]
/ ontrialend = [if(expressions.trialnumber!=0)values.raw_rtsum=values.raw_rtsum+values.rt]
/ ontrialend = [if(expressions.trialnumber!=0)values.ns_ntotal+=1]
/ ontrialend = [if(expressions.trialnumber!=0 && trial.nstrial.response==0)values.ns_nmiss+=1]
/ ontrialend = [if(values.correct==2 && expressions.trialnumber!=0){
    values.ns_ncorr+=1; values.ns_rtcorrsum=values.ns_rtcorrsum+values.rt}]
/ ontrialend = [if(trial.nstrial.response==values.leftkey)values.response=1]
/ ontrialend = [if(trial.nstrial.response==values.rightkey)values.response=2]
/ ontrialend = [if(trial.nstrial.response==0)values.response=0]
/ stimulustimes = [0=fixation; 250=stim; 1500=erasestim]
/ responsetime = 250
/ pretrialpause = values.pretrialpause
/ posttrialpause = values.posttrialpause
/ trialduration = values.trialduration
/ responseinterrupt = frames
/ isvalidresponse = [trial.nstrial.response==0||trial.nstrial.response==values.leftkey||trial.nstrial.response==values.rightkey]
/ iscorrectresponse = [(values.expcondition == 1 && if(values.stimulus<=40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey) ||
                        (values.expcondition == 2 && if(values.stimulus>40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey)]
/ monkeyresponse = (values.leftkey, values.rightkey)
</trial>

/ iscorrectresponse = [(values.expcondition == 1 && trial.practicetrial_a.responsey < values.mouse_y) ||
                        (values.expcondition == 2 && trial.practicetrial_a.responsey > values.mouse_y)]

I asked you to provide the full script and all files it requires to run. I also asked you to explain what the faulty code is actually intended to do.

Code for a single <trial> element from the script is not responsive to either of these requests and does not enable me to tell you (a) what's wrong with your code and (b) how to fix it.

Please provide the information and materials I asked for. Thank you.

Thank you for your patience. I tried to avoid upload the whole script and any pictures it needs, since I don't know anything about the rights and permissions. Anyways, I fixed it by try end error, there were to many parantheses.
Best, Franzisk
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search