Sending TTL triggers to EEG Neuroscan with Psychtoolbox 3.0.12 (Win7/64bit)

6 visualizaciones (últimos 30 días)
SLC891
SLC891 el 2 de Jun. de 2016
Comentada: Rawan el 28 de Jun. de 2024
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.

Respuestas (3)

Walter Roberson
Walter Roberson el 2 de Jun. de 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 comentarios
SLC891
SLC891 el 3 de Jun. de 2016
Hi Walter, thanks. I've changed my code, but I'm still getting: "The function sendTrigger might be unused. It appears that the code never uses the indicated local function or nested function because: There is no obvious call of the function. The code does not compute a function handle for the function. The code does not include a string containing the name of the function. If the code had such a string, Code Analyzer would not produce this message because it would indicate that the string might be passed to feval or a callback."
I have input all the calls to function throughout the script. The script is running properly, but not triggers are appearing on Neuroscan.
Do you think this might be because of what you were saying about the parallel ports?
Walter Roberson
Walter Roberson el 3 de Jun. de 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 .

Iniciar sesión para comentar.


Samuel Zamora Lugo
Samuel Zamora Lugo el 27 de Feb. de 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.

Almario Abenoja
Almario Abenoja el 3 de Jun. de 2023
Not sure if this answered as it is an old post, ideally you need some pause or delay between triggers

Categorías

Más información sobre Timing and presenting 2D and 3D stimuli en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by