E-prime + Datapixx/ResponsePixx + Matlab/psychtoolbox

112 views
Skip to first unread message

j e

unread,
Jun 18, 2022, 2:07:56 PM6/18/22
to E-Prime
Hi E-primers

We have an E-prime3 task that we are using with Datapixx3 and ResponsePixx. We use Matlab/Psychtoolbox to read responses from ResponsePixx.

E-prime has some commands to work with Psychtoolbox, received from VPixx. First Matlab is opened as administrator, then we give command inside matlab: regmatlabserver. And these are in E-prime:

     Dim ML As Object 
     Dim res As String 
     Set ML = CreateObject("Matlab.Application") 
     res = ML.Execute("ResponsePixx('Open', 100, 12e6, 2)") 
     res = ML.Execute("Datapixx('RegWr')")

     res = ML.Execute("ResponsePixx('Close')")

These are opening the Datapixx/Responsepixx, and closing the datapixx in the end of the task. Currently all inside InLine objects at the beginning and end of the task.

Then additionally this code waits for button presses and supposedly would talk with Matlab
      res = ML.Execute("waitForButtonPress([5, 10], 30)")

I have a feeling that at least the waitforbuttonpress command should be in the User Script and then added to our Stimulus textdisplay object's Task events. Could that be the right direction? Any tips on how to define the button presses and save them within E-prime?

E-prime also logs responses with InLine stim.RESP code that works fine with keyboard but not yet with the responsebuttons.

The challenge is that we are not able to command E-prime to react to and log ResponsePixx button presses. We can open the datapixx with the E-prime commands (interpreting this since Matlab opens additional command window when running the E-prime task). Matlab can read responses with psychtoolbox but returning the responses back to E-prime is not yet happening.

Has anyone succeeded in this already?
All tips would be welcome and appreciated!

I have the impression that using socket device (datapixx) as a response device is not the solution. 

I am new to E-prime, just to let you know if the descriptions sound funny.

Best,
Jasmin

David McFarlane

unread,
Jul 28, 2022, 4:37:14 PM7/28/22
to e-p...@googlegroups.com
[Addressing some old posts here, probably too late to do any good ...]

Jasmin,

I do not have a ResponsePixx to work with, nor documentation for the
waitForButtonPress() function, so I am working blindly here.

But let's suppose that the line

res = ML.Execute("waitForButtonPress([5, 10], 30)")

actually pauses program execution until ResponsePixx gets a button
press, and returns the value of the button pressed in the variable res
(possibly including a time stamp). (Hmm, but then how would you add a
time limit for the response?)

Now lets' suppose that you want to use the ResponsPixx to get a response
to the E-Prime object StimText. In that case, I think you would set up
StimText with a Duration of 0. Then you would handle the response
collection in InLine code following StimText, thus:

res = ML.Execute("waitForButtonPress([5, 10], 30)")
StimText.RTTime = Clock.Read
StimText.RT = StimText.RTTime - StimText.OnsetTime
StimText.RESP = res

You can use the Logging properties in StimText to enable response
logging, otherwise you would add the logging in your InLine code.

Again, I am working blindly here, would like to know if any of this
actually works.

-- David McFarlane
Reply all
Reply to author
Forward
0 new messages