Cedrus Community Forums

Cedrus Community Forums (http://community.cedrus.com/index.php)
-   Matlab Support (http://community.cedrus.com/forumdisplay.php?f=15)
-   -   How to send trigger from matlab to StimTracker (http://community.cedrus.com/showthread.php?t=1299)

eeg July 13th, 2011 02:34 AM

How to send trigger from matlab to StimTracker
 
Hi,
I'm a phd student in psychology, We recently bought a Brain vision EEG and a cedrus stimTracker device. I'd like to thanks first people from this forum for the usefull information I found to make the RB device works and send a trigger to StimTracker, CedrusResponseBox.m works properly. But Now I have to add to my experimental code (in matlab) command line to send to say when does the stimulus occurs. And I don't have any clue about the command I have to use, I checked the support for stim tracker and unhopfully nothing is said for matlab users.
I would be extremly gratfull for any help.
Cedric

Hisham July 14th, 2011 11:16 AM

Hi Cédric,

The same code CedrusResponseBox.m should still work as far as opening the serial port, sending bytes, and closing it. However, the commands are different. The ones that you need are posted on this page:
http://www.cedrus.com/support/stimtr...t_commands.htm
I hope this helps.

eeg July 15th, 2011 08:56 AM

Hi hisham,
I did see that already but i did knew how to use this command.
I think I found out now that I have to use the fprint function. I succed (Thanks to you), to send some triggers visible from my eeg recording, but there are still some weerd stuff hapening.
I used as a try the following code (I don't know what's a byte mask so I tried 1010 and 0101):

s1 = serial('COM2', 'BaudRate', 115200,'DataBits', 8, 'StopBits', 1, 'FlowControl', 'none', 'Parity', 'none', 'Terminator', 'CR', 'Timeout', 400, 'InputBufferSize', 16000);
fopen(s1);
fprintf(s1,['mh',0101]); % return R10 on my eeg recording
WaitSecs(1);
fprintf(s1,['mh',1010]);% return R14 on my eeg recording
WaitSecs(1);
fprintf(s1,['mh',0101]);
WaitSecs(1);
fprintf(s1,['mh',1010]);
WaitSecs(1);
fprintf(s1,['mh',0101]);
WaitSecs(1);
fprintf(s1,['mh',1010]);
WaitSecs(1);
fprintf(s1,['mh',0101]);
WaitSecs(1);
fprintf(s1,['mh',1010]);
WaitSecs(1);

But I figure out that the first is never shown by my eeg recording, and also I can't use the same twice in a row (To see the triggers appearing I have to alternate 0101 & 1010). I really wonder Why ?
Thx again for everything

Hisham July 22nd, 2011 11:47 PM

Alas, we really cannot provide support for Matlab code, or at least not yet. However, see the following E-Prime code ; the syntax is a little different from Matlab's but it should help.


All times are GMT -7. The time now is 02:06 PM.


© Copyright Cedrus Corporation, 1991-2014.