java.lang.Thread.sleep(pulseLen); % wait long enough for the EEG system to capture the trigger, i.e., 2000/samplerate ms
java.lang.Thread.sleep(pulseLen); % wait long enough for the EEG system to capture the trigger, i.e., 2000/samplerate ms
% reset marker
% reset marker
−
bb.sendTrigger(0) % Note: if resetting the marker is not possible at this moment in code, you can decide to do this later as long as it has taken place long enough before the next marker has to be sent.
+
bb.sendTrigger(0) % Note: if resetting the marker is not possible at this moment in code, you can decide to do this later as long as it has taken place long enough before the next marker has to be sent. Another solution using a timer object instead of a simple delay is outlined below.
</syntaxhighlight>
</syntaxhighlight>
Line 385:
Line 385:
:
:
bb.close();
bb.close();
+
</syntaxhighlight>
+
+
Reset marker using a timer:
+
<syntaxhighlight lang="matlab" line style="overflow:auto;">
+
% At the start of your script, define timer object and callback function
+
pulseTime = 0.004; % trigger pulse duration in s. NB: extra time will be added due to overhead in calling Matlab functions related to the timer event.