Millisecond Forums

Latency for multiple responses in one trial

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

By nidhi_desai - 1/26/2021

How can I save the response time between each response when the participant can respond multiple times during one trial?
By Dave - 1/26/2021

nidhi_desai - 1/26/2021
How can I save the response time between each response when the participant can respond multiple times during one trial?


<block myblock>
/ trials = [1=mytrial]
</block>

<values>
/ n_responses = 0
/ rt = 0
/ prev_rt = 0
/ diff_rt = 0
</values>

<trial mytrial>
/ ontrialbegin = [
    values.n_responses = 0;
    values.rt = 0;
    values.prev_rt = 0;
    values.diff_rt = 0;
]
/ stop = [
  trial.mytrial.elapsedtime >= 10000;
]
/ stimulustimes = [0=clearscreen,mytext]
/ validresponse = ("E", "I")
/ isvalidresponse = [
    if (trial.mytrial.responsetext == "E" || trial.mytrial.responsetext == "I"){
        values.n_responses += 1;
        values.rt = trial.mytrial.latency;
        values.diff_rt = values.rt - values.prev_rt;
        values.prev_rt = values.rt;
        true;
    }
]
/ responsemessage = ("E", Epress, 100)
/ responsemessage = ("I", Ipress, 100)
</trial>

<text mytext>
/ items = ("Press the E and I keys. You have 10 seconds.")
/ erase = false
</text>

<text Epress>
/ items = ("Pressed E")
/ position = (50%, 90%)
</text>

<text Ipress>
/ items = ("Pressed I")
/ position = (50%, 90%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency values.diff_rt values.n_responses)
</data>


By nidhi_desai - 1/26/2021

Dave - 1/26/2021
nidhi_desai - 1/26/2021
How can I save the response time between each response when the participant can respond multiple times during one trial?


<block myblock>
/ trials = [1=mytrial]
</block>

<values>
/ n_responses = 0
/ rt = 0
/ prev_rt = 0
/ diff_rt = 0
</values>

<trial mytrial>
/ ontrialbegin = [
    values.n_responses = 0;
    values.rt = 0;
    values.prev_rt = 0;
    values.diff_rt = 0;
]
/ stop = [
  trial.mytrial.elapsedtime >= 10000;
]
/ stimulustimes = [0=clearscreen,mytext]
/ validresponse = ("E", "I")
/ isvalidresponse = [
    if (trial.mytrial.responsetext == "E" || trial.mytrial.responsetext == "I"){
        values.n_responses += 1;
        values.rt = trial.mytrial.latency;
        values.diff_rt = values.rt - values.prev_rt;
        values.prev_rt = values.rt;
        true;
    }
]
/ responsemessage = ("E", Epress, 100)
/ responsemessage = ("I", Ipress, 100)
</trial>

<text mytext>
/ items = ("Press the E and I keys. You have 10 seconds.")
/ erase = false
</text>

<text Epress>
/ items = ("Pressed E")
/ position = (50%, 90%)
</text>

<text Ipress>
/ items = ("Pressed I")
/ position = (50%, 90%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency values.diff_rt values.n_responses)
</data>



Oh great, that would work! One quick question so for each response made by the participant <data> will have a new row, even if the responses are all in one <trial>?
By Dave - 1/26/2021

nidhi_desai - 1/26/2021
Dave - 1/26/2021
nidhi_desai - 1/26/2021
How can I save the response time between each response when the participant can respond multiple times during one trial?


<block myblock>
/ trials = [1=mytrial]
</block>

<values>
/ n_responses = 0
/ rt = 0
/ prev_rt = 0
/ diff_rt = 0
</values>

<trial mytrial>
/ ontrialbegin = [
    values.n_responses = 0;
    values.rt = 0;
    values.prev_rt = 0;
    values.diff_rt = 0;
]
/ stop = [
  trial.mytrial.elapsedtime >= 10000;
]
/ stimulustimes = [0=clearscreen,mytext]
/ validresponse = ("E", "I")
/ isvalidresponse = [
    if (trial.mytrial.responsetext == "E" || trial.mytrial.responsetext == "I"){
        values.n_responses += 1;
        values.rt = trial.mytrial.latency;
        values.diff_rt = values.rt - values.prev_rt;
        values.prev_rt = values.rt;
        true;
    }
]
/ responsemessage = ("E", Epress, 100)
/ responsemessage = ("I", Ipress, 100)
</trial>

<text mytext>
/ items = ("Press the E and I keys. You have 10 seconds.")
/ erase = false
</text>

<text Epress>
/ items = ("Pressed E")
/ position = (50%, 90%)
</text>

<text Ipress>
/ items = ("Pressed I")
/ position = (50%, 90%)
</text>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency values.diff_rt values.n_responses)
</data>



Oh great, that would work! One quick question so for each response made by the participant <data> will have a new row, even if the responses are all in one <trial>?

Yes.