How to make a target appear and then disappear

2 ビュー (過去 30 日間)
Dax Cvancara
Dax Cvancara 2022 年 6 月 1 日
コメント済み: Dax Cvancara 2022 年 6 月 6 日
Hello, I am new to MatLab and working on an experiment where a participant will be moving their eyes from one dot to another. I have created a rudimentary figure with associated code which contains the basic design that our team wants. I would like to make the dot on the right appear for 0.3 seconds and then disappear but am stuck trying to figure that out. I would greatly appreciate any help. Feel free to reach out via email at djcvan@uw.edu if that would be easier.

回答 (2 件)

Geoff Hayes
Geoff Hayes 2022 年 6 月 2 日
@Dax Cvancara - try using a timer to delete the graphics object (of the right dot) after 0.3 seconds. Nest your code into a main function like this
function plotv1
gazeFigure = figure('color','black','KeyPressFcn',@keyboardFunction); % Create background
gazeAxes = axes('color','black','XLim',[0 2.0],'YLim',[0 2.0]); % define the axis
gazeFixation = line(1,1,'marker','.','markersize',50,'color',[1 1 0]); %Central fixation point
gazeTarget = line(1.5,1,'marker','.','markersize',50,'color',[1 1 0]); %Target point
timerObj = timer('TimerFcn', @timerCallback, 'StartDelay', 0.3, 'ExecutionMode', 'singleShot');
start(timerObj);
function timerCallback(~, ~)
delete(gazeTarget);
end
end
  1 件のコメント
Dax Cvancara
Dax Cvancara 2022 年 6 月 6 日
@Geoff Hayes thank you so much for your expertise! I appreciate your help

サインインしてコメントする。


Walter Roberson
Walter Roberson 2022 年 6 月 2 日
For work such as this, I recommend that you use the third-party Psychtoolbox, which is designed to be able to create precise timing of stimulus.
  1 件のコメント
Dax Cvancara
Dax Cvancara 2022 年 6 月 6 日
@Walter Roberson I am attempting to download it now but it has been a challenge as I am using a old computer (windows 32-bit) without access to the internet. Will hopefully have it downloaded by the end of the day.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeTiming and presenting 2D and 3D stimuli についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by