temp={}; for i=1:52338 if isequal(allHandData{i,5},'CS') && ~isnan(allHandData{i,9}); temp=[temp;allHandData(i,:)]; end end which=ceil(rand()*size(temp,1)); turns=temp{which,6}; turnTimes=temp{which,7}; figure; hold on; for i=1:size(turns,1) if turns(i)==1 plot([turnTimes(i) turnTimes(i)], [0 -1]); else plot([turnTimes(i) turnTimes(i)], [0 1]); end end sum(turns)/length(turns)