Need to use an external trigger to initiate script commands

4 views (last 30 days)
Stu McAfee
Stu McAfee on 26 Oct 2015
Answered: Rahul Goel on 28 Oct 2015
I'm using Matlab to present stimuli for a series of experiments, and want to be able to precisely control the timing of their presentation based on external events. Previously I had been using TTL pulses through the parallel port, but that solution no longer works due to security updates which needed to be implemented by my university.
The script I was using for the trigger was as follows, using the daq legacy interface:
daqregister('parallel')
digin=digitalio('parallel','LPT1')
addline(digin, 0, 'in')
And the computer would idle when input was not received using:
while getvalue(digin)<1
...
end
This was embedded in a larger loop to show multiple stimuli. This solution worked very efficiently, so is there anything similar I could use if I purchased a USB device for the updated interface? Or is anyone aware of another simple solution, especially if I can use step voltage signals like TTL as the input? I'm using these commands in conjunction with psychtoolbox. Thank you!

Answers (1)

Rahul Goel
Rahul Goel on 28 Oct 2015
Hi Stu,
It will help the community to assist you better if you could share more details about your setup. For example, what do you mean by external triggers? If you mean callback functions using the usb interface, you can refer to the following documentation:
Additionally, you can share the device details, and a sample workflow as well.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by