Sending TTL triggers to EEG Neuroscan with Psychtoolbox 3.0.12 (Win7/64bit)
13 次查看(过去 30 天)
显示 更早的评论
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.
回答(3 个)
Walter Roberson
2016-6-2
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 个评论
Walter Roberson
2016-6-3
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
2018-2-27
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 个评论
Almario Abenoja
2023-6-3
Not sure if this answered as it is an old post, ideally you need some pause or delay between triggers
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!