clear all; close all; clc; num_of_blocks = 4; %Determine number of blocks num_of_trials = 50; %Determine how many trials per block % Initiate LSL Muse connection and recording [lib, info, outlet] = LSL_Muse_InitiationLR(1); %This initiates the Muse, opens an 'impedance' check, and begins recording. Screen('Preference', 'SkipSyncTests', 1); Screen('Preference', 'ConserveVRAM', 64); [win, rec] = Screen('OpenWindow', 0 , [166 166 166],[], 32, 2); xmid = rec(3)/2; ymid = rec(4)/2; for block = 1:num_of_blocks %Block message DrawFormattedText(win,['Block ' num2str(block)],'center','center',[255 255 255]); Screen('Flip',win); WaitSecs(2); for trial = 1:num_of_trials %Determine whether oddball or control if rand < .25 colour = [0 255 0]; marker = 201; else colour = [0 0 255]; marker = 202; end %Draw fixation for 300 - 500ms DrawFormattedText(win,'+','center','center',[255 255 255]); % send a marker LSL_flipandmark(marker,win,outlet,1); Screen('Flip',win); % wait for fixation delat fixation_interval = rand()*.2 + .3; WaitSecs(fixation_interval); %Draw circle for 800ms Screen('FillOval', win , colour, [xmid-30 ymid-30 xmid+30 ymid+30], 8); % sedn a marker LSL_flipandmark(marker+10,win,outlet,1); Screen('Flip',win); % wait WaitSecs(.8); end end Screen('Close All');