how to display multiple images in matlab gui axes one by one by 10 second intervals??

1 回表示 (過去 30 日間)
Tugba Ergin
Tugba Ergin 2019 年 1 月 24 日
コメント済み: Tugba Ergin 2019 年 1 月 24 日
only one axes and show a lot of images by 10 seconds intervals when I click start button. how can I do?

回答 (1 件)

Jan
Jan 2019 年 1 月 24 日
"10 seconds" interval sounds like a job for a timer. Is "click start button" a part of the problem? If so, please explain this with details.
function StartButtonCallback(hObject, EventData, handles)
TimerUD.Folder = 'C:\Your\Images\';
TimerUD.Index = 0;
TimerUD.ImageH = image(handles.theWantedAxes, []);
TimerH = timer('ExecutionMode', 'fixedRate', ...
'Period', 10, ...
'TimerFcn', @timerCallback, ...
'UserData', TimerUD)
end
function timerCallback(TimerH, EventData)
TimerUD = get(TimerH, 'UserData');
TimerUD.Index = TimerUD.Index + 1;
% A bold guess how to get the next image:
Img = imread(fullfile(TimerUD.Folder, sprintf('File%d.png', TimerUD.Index)));
set(TimerUD.ImageH, 'CData', Img);
end
I had to guess a lot of details: Where do you want to display the image? How is the callback of the "Start button" called? How to obtain the "next image"?
I did not implement how the timer is finished, when all images have been shown. This would require more guessing. Please add more details to questions.
  1 件のコメント
Tugba Ergin
Tugba Ergin 2019 年 1 月 24 日
Clicking the start button will open a new window. and I want the pictures to pass by itself in 10 second increments.

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

カテゴリ

Help Center および File ExchangeImages についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by