store latency from previous trial


store latency from previous trial

Author
Message
nakayama
nakayama
Distinguished Member
Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)

Group: Forum Members
Posts: 64, Visits: 374
Hi Inquisit Community,
I am looking for s syntax to store the reponse.latency from the (previous) n-1 trial and compare it (for example, to calculate the latency difference between the n-1 trial and the n trial) with the latency of current trial.
Is there a way to do this?
Thank you in advanceWink
Attachments
test2.iqx (5 views, 1.00 KB)
Dave
Dave
Supreme Being
Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)

Group: Administrators
Posts: 9.9K, Visits: 49K
nakayama - 10/30/2019
Hi Inquisit Community,
I am looking for s syntax to store the reponse.latency from the (previous) n-1 trial and compare it (for example, to calculate the latency difference between the n-1 trial and the n trial) with the latency of current trial.
Is there a way to do this?
Thank you in advanceWink

<values>
/ previouslatency = -1
/ currentlatency = -1
</values>

<trial sound>
/ ontrialbegin = [
values.previouslatency = trial.sound.latency;
]
/ ontrialend = [
values.currentlatency = trial.sound.latency;
]
/ ontrialbegin = [trial.sound.resetstimulusframes()]
/ stimulustimes = [0=screen, tone; 50=circleshape;2000=tone]
/ inputdevice = mouse
/ validresponse = (circleshape)
/ beginresponsetime = 50
/ responseinterrupt = frames
/ branch = [trial.release]
</trial>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode response correct latency values.currentlatency values.previouslatency)
</data>

nakayama
nakayama
Distinguished Member
Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)

Group: Forum Members
Posts: 64, Visits: 374
Dave - 10/30/2019
nakayama - 10/30/2019
Hi Inquisit Community,
I am looking for s syntax to store the reponse.latency from the (previous) n-1 trial and compare it (for example, to calculate the latency difference between the n-1 trial and the n trial) with the latency of current trial.
Is there a way to do this?
Thank you in advanceWink

<values>
/ previouslatency = -1
/ currentlatency = -1
</values>

<trial sound>
/ ontrialbegin = [
values.previouslatency = trial.sound.latency;
]
/ ontrialend = [
values.currentlatency = trial.sound.latency;
]
/ ontrialbegin = [trial.sound.resetstimulusframes()]
/ stimulustimes = [0=screen, tone; 50=circleshape;2000=tone]
/ inputdevice = mouse
/ validresponse = (circleshape)
/ beginresponsetime = 50
/ responseinterrupt = frames
/ branch = [trial.release]
</trial>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode response correct latency values.currentlatency values.previouslatency)
</data>
thank you for your advice.
may I add one more question down here?
is there a syntax to calculate the mean (average) of response.latency every , say, 30 trials?
thank youWink
Dave
Dave
Supreme Being
Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)

Group: Administrators
Posts: 9.9K, Visits: 49K
nakayama - 10/31/2019
Dave - 10/30/2019
nakayama - 10/30/2019
Hi Inquisit Community,
I am looking for s syntax to store the reponse.latency from the (previous) n-1 trial and compare it (for example, to calculate the latency difference between the n-1 trial and the n trial) with the latency of current trial.
Is there a way to do this?
Thank you in advanceWink

<values>
/ previouslatency = -1
/ currentlatency = -1
</values>

<trial sound>
/ ontrialbegin = [
values.previouslatency = trial.sound.latency;
]
/ ontrialend = [
values.currentlatency = trial.sound.latency;
]
/ ontrialbegin = [trial.sound.resetstimulusframes()]
/ stimulustimes = [0=screen, tone; 50=circleshape;2000=tone]
/ inputdevice = mouse
/ validresponse = (circleshape)
/ beginresponsetime = 50
/ responseinterrupt = frames
/ branch = [trial.release]
</trial>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode response correct latency values.currentlatency values.previouslatency)
</data>
thank you for your advice.
may I add one more question down here?
is there a syntax to calculate the mean (average) of response.latency every , say, 30 trials?
thank youWink

That's just simple math and conditional logic; you can do this in any number of ways.

<block example>
/ trials = [1-90 = exampletrial]
</block>

<values>
/ trialcounter = 0
</values>

<list latencies_1st_30>
</list>

<list latencies_2nd_30>
</list>

<list latencies_3rd_30>
</list>

<trial exampletrial>
/ pretrialpause = 500
/ ontrialbegin = [
values.trialcounter += 1;
]
/ stimulusframes = [1=exampletext]
/ validresponse = (57)
/ ontrialend = [
if (values.trialcounter <= 30) {
list.latencies_1st_30.appenditem(trial.exampletrial.latency);
} else if (values.trialcounter > 30 && values.trialcounter <= 60) {
list.latencies_2nd_30.appenditem(trial.exampletrial.latency);
} else if (values.trialcounter > 60 && values.trialcounter <= 90) {
list.latencies_3rd_30.appenditem(trial.exampletrial.latency);
};
]
</trial>

<text exampletext>
/ items = ("Press SPACE as quickly as possible")
</text>

<summarydata>
/ columns = (script.startdate script.starttime script.subjectid script.groupid list.latencies_1st_30.mean list.latencies_2nd_30.mean list.latencies_3rd_30.mean)
/ separatefiles = true
</summarydata>



nakayama
nakayama
Distinguished Member
Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)

Group: Forum Members
Posts: 64, Visits: 374
Dave - 10/31/2019
nakayama - 10/31/2019
Dave - 10/30/2019
nakayama - 10/30/2019
Hi Inquisit Community,
I am looking for s syntax to store the reponse.latency from the (previous) n-1 trial and compare it (for example, to calculate the latency difference between the n-1 trial and the n trial) with the latency of current trial.
Is there a way to do this?
Thank you in advanceWink

<values>
/ previouslatency = -1
/ currentlatency = -1
</values>

<trial sound>
/ ontrialbegin = [
values.previouslatency = trial.sound.latency;
]
/ ontrialend = [
values.currentlatency = trial.sound.latency;
]
/ ontrialbegin = [trial.sound.resetstimulusframes()]
/ stimulustimes = [0=screen, tone; 50=circleshape;2000=tone]
/ inputdevice = mouse
/ validresponse = (circleshape)
/ beginresponsetime = 50
/ responseinterrupt = frames
/ branch = [trial.release]
</trial>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode response correct latency values.currentlatency values.previouslatency)
</data>
thank you for your advice.
may I add one more question down here?
is there a syntax to calculate the mean (average) of response.latency every , say, 30 trials?
thank youWink

That's just simple math and conditional logic; you can do this in any number of ways.

<block example>
/ trials = [1-90 = exampletrial]
</block>

<values>
/ trialcounter = 0
</values>

<list latencies_1st_30>
</list>

<list latencies_2nd_30>
</list>

<list latencies_3rd_30>
</list>

<trial exampletrial>
/ pretrialpause = 500
/ ontrialbegin = [
values.trialcounter += 1;
]
/ stimulusframes = [1=exampletext]
/ validresponse = (57)
/ ontrialend = [
if (values.trialcounter <= 30) {
list.latencies_1st_30.appenditem(trial.exampletrial.latency);
} else if (values.trialcounter > 30 && values.trialcounter <= 60) {
list.latencies_2nd_30.appenditem(trial.exampletrial.latency);
} else if (values.trialcounter > 60 && values.trialcounter <= 90) {
list.latencies_3rd_30.appenditem(trial.exampletrial.latency);
};
]
</trial>

<text exampletext>
/ items = ("Press SPACE as quickly as possible")
</text>

<summarydata>
/ columns = (script.startdate script.starttime script.subjectid script.groupid list.latencies_1st_30.mean list.latencies_2nd_30.mean list.latencies_3rd_30.mean)
/ separatefiles = true
</summarydata>



Hi, Dave thank you for the syntax, that's quite helpfulWink

I wish to use the calculated list.latencies_1st_30.mean for further calculation in the trial. Like:
/ ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30_mean}]
But the data value turned out with blank. Is there a way to fix it?
Best
Dave
Dave
Supreme Being
Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)

Group: Administrators
Posts: 9.9K, Visits: 49K
nakayama - 11/6/2019
Dave - 10/31/2019
nakayama - 10/31/2019
Dave - 10/30/2019
nakayama - 10/30/2019
Hi Inquisit Community,
I am looking for s syntax to store the reponse.latency from the (previous) n-1 trial and compare it (for example, to calculate the latency difference between the n-1 trial and the n trial) with the latency of current trial.
Is there a way to do this?
Thank you in advanceWink

<values>
/ previouslatency = -1
/ currentlatency = -1
</values>

<trial sound>
/ ontrialbegin = [
values.previouslatency = trial.sound.latency;
]
/ ontrialend = [
values.currentlatency = trial.sound.latency;
]
/ ontrialbegin = [trial.sound.resetstimulusframes()]
/ stimulustimes = [0=screen, tone; 50=circleshape;2000=tone]
/ inputdevice = mouse
/ validresponse = (circleshape)
/ beginresponsetime = 50
/ responseinterrupt = frames
/ branch = [trial.release]
</trial>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode response correct latency values.currentlatency values.previouslatency)
</data>
thank you for your advice.
may I add one more question down here?
is there a syntax to calculate the mean (average) of response.latency every , say, 30 trials?
thank youWink

That's just simple math and conditional logic; you can do this in any number of ways.

<block example>
/ trials = [1-90 = exampletrial]
</block>

<values>
/ trialcounter = 0
</values>

<list latencies_1st_30>
</list>

<list latencies_2nd_30>
</list>

<list latencies_3rd_30>
</list>

<trial exampletrial>
/ pretrialpause = 500
/ ontrialbegin = [
values.trialcounter += 1;
]
/ stimulusframes = [1=exampletext]
/ validresponse = (57)
/ ontrialend = [
if (values.trialcounter <= 30) {
list.latencies_1st_30.appenditem(trial.exampletrial.latency);
} else if (values.trialcounter > 30 && values.trialcounter <= 60) {
list.latencies_2nd_30.appenditem(trial.exampletrial.latency);
} else if (values.trialcounter > 60 && values.trialcounter <= 90) {
list.latencies_3rd_30.appenditem(trial.exampletrial.latency);
};
]
</trial>

<text exampletext>
/ items = ("Press SPACE as quickly as possible")
</text>

<summarydata>
/ columns = (script.startdate script.starttime script.subjectid script.groupid list.latencies_1st_30.mean list.latencies_2nd_30.mean list.latencies_3rd_30.mean)
/ separatefiles = true
</summarydata>



Hi, Dave thank you for the syntax, that's quite helpfulWink

I wish to use the calculated list.latencies_1st_30.mean for further calculation in the trial. Like:
/ ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30_mean}]
But the data value turned out with blank. Is there a way to fix it?
Best

/ ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30_mean}]

is clearly wrong. There is no list called "latencies_1st_30_mean". The syntax to access a list's mean property is

list.listname.mean

where listname is the name of the given <list> element, exactly as exemplified in the code in my previous reply:


nakayama
nakayama
Distinguished Member
Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)

Group: Forum Members
Posts: 64, Visits: 374
Dave - 11/6/2019
nakayama - 11/6/2019
Dave - 10/31/2019
nakayama - 10/31/2019
Dave - 10/30/2019
nakayama - 10/30/2019
Hi Inquisit Community,
I am looking for s syntax to store the reponse.latency from the (previous) n-1 trial and compare it (for example, to calculate the latency difference between the n-1 trial and the n trial) with the latency of current trial.
Is there a way to do this?
Thank you in advanceWink

<values>
/ previouslatency = -1
/ currentlatency = -1
</values>

<trial sound>
/ ontrialbegin = [
values.previouslatency = trial.sound.latency;
]
/ ontrialend = [
values.currentlatency = trial.sound.latency;
]
/ ontrialbegin = [trial.sound.resetstimulusframes()]
/ stimulustimes = [0=screen, tone; 50=circleshape;2000=tone]
/ inputdevice = mouse
/ validresponse = (circleshape)
/ beginresponsetime = 50
/ responseinterrupt = frames
/ branch = [trial.release]
</trial>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode response correct latency values.currentlatency values.previouslatency)
</data>
thank you for your advice.
may I add one more question down here?
is there a syntax to calculate the mean (average) of response.latency every , say, 30 trials?
thank youWink

That's just simple math and conditional logic; you can do this in any number of ways.

<block example>
/ trials = [1-90 = exampletrial]
</block>

<values>
/ trialcounter = 0
</values>

<list latencies_1st_30>
</list>

<list latencies_2nd_30>
</list>

<list latencies_3rd_30>
</list>

<trial exampletrial>
/ pretrialpause = 500
/ ontrialbegin = [
values.trialcounter += 1;
]
/ stimulusframes = [1=exampletext]
/ validresponse = (57)
/ ontrialend = [
if (values.trialcounter <= 30) {
list.latencies_1st_30.appenditem(trial.exampletrial.latency);
} else if (values.trialcounter > 30 && values.trialcounter <= 60) {
list.latencies_2nd_30.appenditem(trial.exampletrial.latency);
} else if (values.trialcounter > 60 && values.trialcounter <= 90) {
list.latencies_3rd_30.appenditem(trial.exampletrial.latency);
};
]
</trial>

<text exampletext>
/ items = ("Press SPACE as quickly as possible")
</text>

<summarydata>
/ columns = (script.startdate script.starttime script.subjectid script.groupid list.latencies_1st_30.mean list.latencies_2nd_30.mean list.latencies_3rd_30.mean)
/ separatefiles = true
</summarydata>



Hi, Dave thank you for the syntax, that's quite helpfulWink

I wish to use the calculated list.latencies_1st_30.mean for further calculation in the trial. Like:
/ ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30_mean}]
But the data value turned out with blank. Is there a way to fix it?
Best

/ ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30_mean}]

is clearly wrong. There is no list called "latencies_1st_30_mean". The syntax to access a list's mean property is

list.listname.mean

where listname is the name of the given <list> element, exactly as exemplified in the code in my previous reply:


oh, I see .thank you for your clarificationWink
nakayama
nakayama
Distinguished Member
Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)

Group: Forum Members
Posts: 64, Visits: 374
Dave - 11/6/2019
nakayama - 11/6/2019
Dave - 10/31/2019
nakayama - 10/31/2019
Dave - 10/30/2019
nakayama - 10/30/2019
Hi Inquisit Community,
I am looking for s syntax to store the reponse.latency from the (previous) n-1 trial and compare it (for example, to calculate the latency difference between the n-1 trial and the n trial) with the latency of current trial.
Is there a way to do this?
Thank you in advanceWink

<values>
/ previouslatency = -1
/ currentlatency = -1
</values>

<trial sound>
/ ontrialbegin = [
values.previouslatency = trial.sound.latency;
]
/ ontrialend = [
values.currentlatency = trial.sound.latency;
]
/ ontrialbegin = [trial.sound.resetstimulusframes()]
/ stimulustimes = [0=screen, tone; 50=circleshape;2000=tone]
/ inputdevice = mouse
/ validresponse = (circleshape)
/ beginresponsetime = 50
/ responseinterrupt = frames
/ branch = [trial.release]
</trial>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode response correct latency values.currentlatency values.previouslatency)
</data>
thank you for your advice.
may I add one more question down here?
is there a syntax to calculate the mean (average) of response.latency every , say, 30 trials?
thank youWink

That's just simple math and conditional logic; you can do this in any number of ways.

<block example>
/ trials = [1-90 = exampletrial]
</block>

<values>
/ trialcounter = 0
</values>

<list latencies_1st_30>
</list>

<list latencies_2nd_30>
</list>

<list latencies_3rd_30>
</list>

<trial exampletrial>
/ pretrialpause = 500
/ ontrialbegin = [
values.trialcounter += 1;
]
/ stimulusframes = [1=exampletext]
/ validresponse = (57)
/ ontrialend = [
if (values.trialcounter <= 30) {
list.latencies_1st_30.appenditem(trial.exampletrial.latency);
} else if (values.trialcounter > 30 && values.trialcounter <= 60) {
list.latencies_2nd_30.appenditem(trial.exampletrial.latency);
} else if (values.trialcounter > 60 && values.trialcounter <= 90) {
list.latencies_3rd_30.appenditem(trial.exampletrial.latency);
};
]
</trial>

<text exampletext>
/ items = ("Press SPACE as quickly as possible")
</text>

<summarydata>
/ columns = (script.startdate script.starttime script.subjectid script.groupid list.latencies_1st_30.mean list.latencies_2nd_30.mean list.latencies_3rd_30.mean)
/ separatefiles = true
</summarydata>



Hi, Dave thank you for the syntax, that's quite helpfulWink

I wish to use the calculated list.latencies_1st_30.mean for further calculation in the trial. Like:
/ ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30_mean}]
But the data value turned out with blank. Is there a way to fix it?
Best

/ ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30_mean}]

is clearly wrong. There is no list called "latencies_1st_30_mean". The syntax to access a list's mean property is

list.listname.mean

where listname is the name of the given <list> element, exactly as exemplified in the code in my previous reply:


Hi, Dave
I have another question regarding the mean calculation. I calculated values.latencyplus at ontrialend and
wish to also calculate the mean of  "values.latencyplus" at the same time.
however, the first "list.latencies_1st_30.mean" returned with 0, resulting in the calculated 30th list.latencies_1st_30.mean taking 0 in.
is there a way to avoid this? Thank you for your attentionSmile i attached the data as well as the script below.
Attachments
test44.iqx (4 views, 1.00 KB)
Dave
Dave
Supreme Being
Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)

Group: Administrators
Posts: 9.9K, Visits: 49K
nakayama - 11/10/2019
Dave - 11/6/2019
nakayama - 11/6/2019
Dave - 10/31/2019
nakayama - 10/31/2019
Dave - 10/30/2019
nakayama - 10/30/2019
Hi Inquisit Community,
I am looking for s syntax to store the reponse.latency from the (previous) n-1 trial and compare it (for example, to calculate the latency difference between the n-1 trial and the n trial) with the latency of current trial.
Is there a way to do this?
Thank you in advanceWink

<values>
/ previouslatency = -1
/ currentlatency = -1
</values>

<trial sound>
/ ontrialbegin = [
values.previouslatency = trial.sound.latency;
]
/ ontrialend = [
values.currentlatency = trial.sound.latency;
]
/ ontrialbegin = [trial.sound.resetstimulusframes()]
/ stimulustimes = [0=screen, tone; 50=circleshape;2000=tone]
/ inputdevice = mouse
/ validresponse = (circleshape)
/ beginresponsetime = 50
/ responseinterrupt = frames
/ branch = [trial.release]
</trial>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode response correct latency values.currentlatency values.previouslatency)
</data>
thank you for your advice.
may I add one more question down here?
is there a syntax to calculate the mean (average) of response.latency every , say, 30 trials?
thank youWink

That's just simple math and conditional logic; you can do this in any number of ways.

<block example>
/ trials = [1-90 = exampletrial]
</block>

<values>
/ trialcounter = 0
</values>

<list latencies_1st_30>
</list>

<list latencies_2nd_30>
</list>

<list latencies_3rd_30>
</list>

<trial exampletrial>
/ pretrialpause = 500
/ ontrialbegin = [
values.trialcounter += 1;
]
/ stimulusframes = [1=exampletext]
/ validresponse = (57)
/ ontrialend = [
if (values.trialcounter <= 30) {
list.latencies_1st_30.appenditem(trial.exampletrial.latency);
} else if (values.trialcounter > 30 && values.trialcounter <= 60) {
list.latencies_2nd_30.appenditem(trial.exampletrial.latency);
} else if (values.trialcounter > 60 && values.trialcounter <= 90) {
list.latencies_3rd_30.appenditem(trial.exampletrial.latency);
};
]
</trial>

<text exampletext>
/ items = ("Press SPACE as quickly as possible")
</text>

<summarydata>
/ columns = (script.startdate script.starttime script.subjectid script.groupid list.latencies_1st_30.mean list.latencies_2nd_30.mean list.latencies_3rd_30.mean)
/ separatefiles = true
</summarydata>



Hi, Dave thank you for the syntax, that's quite helpfulWink

I wish to use the calculated list.latencies_1st_30.mean for further calculation in the trial. Like:
/ ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30_mean}]
But the data value turned out with blank. Is there a way to fix it?
Best

/ ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30_mean}]

is clearly wrong. There is no list called "latencies_1st_30_mean". The syntax to access a list's mean property is

list.listname.mean

where listname is the name of the given <list> element, exactly as exemplified in the code in my previous reply:


Hi, Dave
I have another question regarding the mean calculation. I calculated values.latencyplus at ontrialend and
wish to also calculate the mean of  "values.latencyplus" at the same time.
however, the first "list.latencies_1st_30.mean" returned with 0, resulting in the calculated 30th list.latencies_1st_30.mean taking 0 in.
is there a way to avoid this? Thank you for your attentionSmile i attached the data as well as the script below.

/ontrialend statements are executed in the order given, top to bottom:

<trial exampletrial>
...
/ ontrialend = [
if (values.trialcounter <= 30)
{list.latencies_1st_30.appenditem(values.latencyplus);}
else if (values.trialcounter > 30 && values.trialcounter <= 60)
{list.latencies_2nd_30.appenditem(values.latencyplus);}
else if (values.trialcounter > 60 && values.trialcounter <= 90)
{list.latencies_3rd_30.appenditem(values.latencyplus);};
]
/ ontrialend = [values.latencyplus=trial.exampletrial.latency+200
]
</trial>

That is, you first add the value of values.larencyplus to the list, and only then actually calculate the value.

You obviously need to do the exact opposite.

<trial exampletrial>
...
/ ontrialend = [values.latencyplus=trial.exampletrial.latency+200
]
/ ontrialend = [
if (values.trialcounter <= 30)
{list.latencies_1st_30.appenditem(values.latencyplus);}
else if (values.trialcounter > 30 && values.trialcounter <= 60)
{list.latencies_2nd_30.appenditem(values.latencyplus);}
else if (values.trialcounter > 60 && values.trialcounter <= 90)
{list.latencies_3rd_30.appenditem(values.latencyplus);};
]
</trial>

nakayama
nakayama
Distinguished Member
Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)

Group: Forum Members
Posts: 64, Visits: 374
Thank you Dave! I didn’t realized ontrialend have orders tooSmile
GO


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....






Millisecond Forums


Search