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

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/stimtracker/tn1450_st_commands.htm

I hope this helps.

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

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.