I'm working on generating attention shift task. And I'm very beginner of MATLAB. When I run this code, it kept generating new figure window. However, I want to make it goes to the next trial without generating new window with the figure. Could someone tell me what did I wrong? Thanks a lot!
DATA = zeros(80,1); % pre-allocation of data matrix
ExoHorizentalV100 = 0;jj = 1; while ExoHorizentalV100 < 80 coin = rand; if coin < 0.5 % cue and target presented in the right
fig = figure; set(fig,'position',get(0,'ScreenSize')) r1 = rectangle('position',[0,150,100,100],'EdgeColor','k','Linewidth',3); xlim([0 400]) ylim([0 400]) hold on plot(200,200,'+','MarkerSize',30,'LineWidth',3,'Color','k'); hold on r2 = rectangle('position',[300,150,100,100],'EdgeColor','k','Linewidth',3); axis square; axis off; pause(4) t = text(180,270,'\rightarrow','FontSize',40,'LineWidth',3,'Color','k'); pause(0.1) set(t,'Visible','off') plot(350,200,'kp','MarkerSize',30,'MarkerFaceColor','k') pause(0.3) elseif coin > 0.5 % cue and target presented in the left
fig = figure; set(fig,'position',get(0,'ScreenSize')) r1 = rectangle('position',[0,150,100,100],'EdgeColor','k','Linewidth',3); xlim([0 400]) ylim([0 400]) hold on plot(200,200,'+','MarkerSize',30,'LineWidth',3,'Color','k'); hold on r2 = rectangle('position',[300,150,100,100],'EdgeColor','k','Linewidth',3); axis square; axis off; pause(4) t = text(180,270,'\leftarrow','FontSize',40,'LineWidth',3,'Color','k'); pause(0.1) set(t,'Visible','off') plot(50,200,'kp','MarkerSize',30,'MarkerFaceColor','k') pause(0.3) end tic; pause ; temp = toc; response = get(fig,'CurrentCharacter'); ExoHorizentalV100 = ExoHorizentalV100 + 1; DATA(jj,1) = temp; jj = jj + 1;end
Best Answer