function [mdat nevt tim evt] = getevents(actname) %tmp=load([actname '.mat']); %mdat=tmp.mdat; load([actname '.mat']); tmp=mdat.evt; evt=zeros(length(tmp),1); for i=1:length(tmp) if isempty(str2num(tmp{i})) evt(i)=NaN; else evt(i)=str2num(tmp{i}); end end tim=mdat.evT; nevt=zeros(length(tmp),3); ori1=NaN; ori2=NaN; cori=NaN; cued=NaN; ncued=NaN; task=NaN; pos1=NaN; pos2=NaN; cpos=NaN; ncpos=NaN; stim1=NaN; stim2=NaN; cstim=NaN; ncstim=NaN; pos3=NaN; ori3=NaN; pingcount=0; tricount=0; fix=1; for i=1:length(evt) if ismember(evt(i),[20:76]) % first stim tricount=tricount+1; ori1=rem(evt(i),20); % first stim ori if ismember(evt(i),[21:36]) stim1=1; elseif ismember(evt(i),[41:56]) stim1=2; elseif ismember(evt(i),[61:76]) stim1=3; end if i