How do I set a certain duration for a stimuli presentation?
5 ビュー (過去 30 日間)
古いコメントを表示
I have a small white spot presented on a grey background. I would like to have the spot stimuli on for 2 secs and then switch to only the grey background for 5 secs. I need help in setting the duration for each stimuli presentation. Also, I need the timing to be as accurate as possible.
1 件のコメント
Chris McComb
2015 年 3 月 4 日
編集済み: Chris McComb
2015 年 3 月 4 日
Are you after something like this?
% Number of stimuli
n = 5;
for i=1:1:n
% Plot the spot
h = plot(x_spot, y_spot);
% Pause for 2 seconds
pause(2);
% Delete the spot
delete(h);
% Wait for 5 seconds
pause(5);
end
回答 (1 件)
Jos (10584)
2015 年 3 月 4 日
I suggest you do not use delete and pause. Here is an alternative
x = [1 2 6 8 3] ;
y = [7 1 3 9 6] ;
stimtime = 1 ; % time to show a spot
waittime = 2 ; % time to wait between spots
% create a plot
clf ; % clear current figure
h = plot(NaN,NaN,'bo','markerfacecolor','r') ;
set(gca,'xlim',[0 10],'ylim',[0 10]) ;
for k=1:numel(x),
set(h,'xdata',x(k),'ydata',y(k),'visible','on') ;
drawnow ;
tic ;
while toc < stimtime, end
set(h,'visible','off') ;
drawnow ;
while toc < stimtime+waittime, end
end
2 件のコメント
Jos (10584)
2015 年 3 月 7 日
I suggest you take a look at the help of the toolbox, and perhaps ask your question over there. This seems to be a very basic problem more related to psychophysics than to matlab itself.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!