Millisecond Forums

setting a different trial duration for every trial

https://forums.millisecond.com/Topic26567.aspx

By nrouhani - 3/18/2019

hello, 

i was wondering whether it would be possible to have every trial have a different duration, where that trial's duration would be pulled from a list. 

thank you! 
By Dave - 3/18/2019

nrouhani - Monday, March 18, 2019
hello, 

i was wondering whether it would be possible to have every trial have a different duration, where that trial's duration would be pulled from a list. 

thank you! 

Yes, that is absolutely possible. The /triaduration attribute accepts variables, i.e. you can easily vary it like so:

<values>
/ duration = 0
</values>

<list durations>
/ items = (1500, 3000, 4500)
</list>


<trial exampletrial>
/ ontrialbegin = [
values.duration = list.durations.nextvalue;
]
/ stimulusframes = [1=examplestimulus]
/ validresponse = (0)
/ trialduration = values.duration
</trial>

<text examplestimulus>
/ items = ("Duration of this trial: <%values.duration%> ms.")
</text>

<block exampleblock>
/ trials = [1-3=exampletrial]
</block>
By nrouhani - 3/19/2019

Dave - Monday, March 18, 2019
nrouhani - Monday, March 18, 2019
hello, 

i was wondering whether it would be possible to have every trial have a different duration, where that trial's duration would be pulled from a list. 

thank you! 

Yes, that is absolutely possible. The /triaduration attribute accepts variables, i.e. you can easily vary it like so:

<values>
/ duration = 0
</values>

<list durations>
/ items = (1500, 3000, 4500)
</list>


<trial exampletrial>
/ ontrialbegin = [
values.duration = list.durations.nextvalue;
]
/ stimulusframes = [1=examplestimulus]
/ validresponse = (0)
/ trialduration = values.duration
</trial>

<text examplestimulus>
/ items = ("Duration of this trial: <%values.duration%> ms.")
</text>

<block exampleblock>
/ trials = [1-3=exampletrial]
</block>

thank you so much!