Count Button Presses in Trial with Fixed Duration


Count Button Presses in Trial with Fixed Duration

Author
Message
Pete
Pete
Associate Member
Associate Member (170 reputation)Associate Member (170 reputation)Associate Member (170 reputation)Associate Member (170 reputation)Associate Member (170 reputation)Associate Member (170 reputation)Associate Member (170 reputation)Associate Member (170 reputation)Associate Member (170 reputation)

Group: Forum Members
Posts: 2, Visits: 6
Hi everyone,

I'm trying to create a trial lasting 3 min in which participants have to press the spacebar every time they come up with an idea. I would like to count how many times the participant presses the spacebar and if possible at what exact points in time during the 3 min interval the presses took place. 

I would really appreciate any help as I seem to be stuck.
Dave
Dave
Supreme Being
Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)

Group: Administrators
Posts: 9.8K, Visits: 46K
Pete - Monday, November 20, 2017
Hi everyone,

I'm trying to create a trial lasting 3 min in which participants have to press the spacebar every time they come up with an idea. I would like to count how many times the participant presses the spacebar and if possible at what exact points in time during the 3 min interval the presses took place. 

I would really appreciate any help as I seem to be stuck.

You can achieve this using /isvalidresponse:

<block ideablock>
/ trials = [1=ideatrial]
</block>

<trial ideatrial>
/ stimulusframes = [1=ideatext]
/ validresponse = (57)
/ isvalidresponse = [if (trial.ideatrial.response == 57) {values.spacebarcount +=1; values.keypresstimes = concat(concat(values.keypresstimes, trial.ideatrial.latency), ";"); false}]
/ timeout = 30000
</trial>

<values>
/ spacebarcount = 0
/ keypresstimes = ""
</values>

<text ideatext>
/ items = ("Press the spacebar whenever you have an idea.")
</text>

<data>
/ columns = [date time subject group blocknum blockcode trialnum trialcode stimulusitem response latency
    values.spacebarcount values.keypresstimes]
/ separatefiles = true
</data>

You'll find the total number of spacebar presses logged in values.spacebarcount; you'll find a list of the exact times when the presses occurred in values.keypresstimes (in milliseconds, measured from the start of the trial).

Pete
Pete
Associate Member
Associate Member (170 reputation)Associate Member (170 reputation)Associate Member (170 reputation)Associate Member (170 reputation)Associate Member (170 reputation)Associate Member (170 reputation)Associate Member (170 reputation)Associate Member (170 reputation)Associate Member (170 reputation)

Group: Forum Members
Posts: 2, Visits: 6
Thank you very much! Works perfectly!


GO


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....






Millisecond Forums


Search