Sending TTL triggers to EEG Neuroscan with Psychtoolbox 3.0.12 (Win7/64bit)
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Trying to set up my script to send pulses to Neuroscan (EEG system), but I've come across a few issues. This is the opening code to call on the parallel port:
config_io;
address = hex2dec('DFF8');
Then I call and define the function at the beginning to make sure the port is open. This is an example of one of the triggers:
function sendTrigger()
outp(address,0);
outp(address,1);
During the experimental script, I then call on the function using:
function sendTrigger()
end
1- What am I doing wrong?
2- Why is it telling me: "The function sendTrigger might be unused"
3- If I use the functions by themselves in the CMD line, then they work fine.
4- When I try to nest it in an "if/else" function (one occurrence), I get "Function keyword is invalid here". I understand that I can't nest a function within an if/else, but I'm not sure how to circumvent the problem whilst keeping the pulse in the right place.
Notes: I'm running Windows 7 on both CPUs
Psychtoolbox is version 3.0.12
Matlab is version: r2016a
Neuroscan is version: 4.5
I'm new to Matlab, so be gentle on me.
1 Kommentar
Antworten (3)
Walter Roberson
am 2 Jun. 2016
To invoke the trigger, just use
sendTrigger()
The "function" keyword is only used for defining new functions.
Your code should look something like,
function drive_the_device
config_io;
address = hex2dec('DFF8');
function sendTrigger()
outp(address,0);
outp(address,1);
end
for K = 1 : 50
sendTrigger();
pause(0.5);
end
end
In practice you are likely to have difficulty in getting a parallel port to work in MS Windows after XP; XP made parallel ports difficult to access from user-space, and Vista restricted them to pretty much signed drivers only with no user access.
2 Kommentare
Walter Roberson
am 3 Jun. 2016
You cannot call a nested function from outside the nesting function, not unless you pass a function handle to outside the nesting function. Notice in my sample code that I called sendTrigger from inside the nesting function. This does not have anything to do with the parallel ports.
You might want to consider something like this:
function sendTrigger = configure_trigger
config_io;
address = hex2dec('DFF8');
sendTrigger = @() sendTrigger_to(address);
end
function sendTrigger_to(address)
outp(address,0);
outp(address,1);
end
The output would be a sendTrigger function handle that you could invoke from outside configure_trigger .
Samuel Zamora Lugo
am 27 Feb. 2018
Good afternoon SLC891 One question: You solved the problem of sending TTL triggers to EEG Neuroscan with Psychtoolbox 3.0.12?
I have the same problem. I need help.
0 Kommentare
Almario Abenoja
am 3 Jun. 2023
Not sure if this answered as it is an old post, ideally you need some pause or delay between triggers
0 Kommentare
Siehe auch
Kategorien
Mehr zu Timing and presenting 2D and 3D stimuli finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!