Archive for the ‘psychToolbox’ Category

Hyperscanning experiment file (matlab)

June 8th, 2017

Below is the experiment script (in MatLab) for our hyperscanning project (”NIRS-based hyperscanning reveals increased interpersonal coherence in superior frontal cortex during cooperation.”). For detailed information please refer to

Psychtoolbox-3 is required.


Author: Xu Cui Categories: brain, matlab, nirs, programming, psychToolbox Tags:

E-prime vs MatLab (+Psychophysics Toolbox)

February 9th, 2010

Both E-prime and MatLab are popular tools for presenting stimuli for fMRI, NIRS and behavioral experiments. Here are a comparison between them.

E-Prime MatLab + psychophysics toolbox
price ~$1000 MatLab cost, $50-500
easy to use easy moderate
need coding no (most cases) yes
flexibility moderate very
timing control moderate can be very accurate
connecting hardware good good
full screen yes can be
Author: Xu Cui Categories: brain, matlab, psychToolbox Tags:

non-blocking pause

November 14th, 2008

Assume you have a presentation and you want it to stay on the screen for 10 seconds, you may write code something like
pause(10) or WaitSecs(10)

It’s fine except you can do nothing within those 10s. What if you want to do something else during the 10s (e.g check if subject pressed a button, or check if the scanner emits some signal)? In this case you should not use pause or WaitSecs, but instead use a while loop:

startTime = GetSecs;
while(GetSecs - startTime < 10)
    ... check keyboard input etc
Author: Xu Cui Categories: matlab, psychToolbox Tags: