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

조회 수: 13 (최근 30일)
SLC891
SLC891 2016년 6월 2일
댓글: Rawan 2024년 6월 28일
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
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
SLC891
SLC891 2016년 6월 3일
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 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
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.

Almario Abenoja
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

카테고리

Help CenterFile Exchange에서 Timing and presenting 2D and 3D stimuli에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by