changing pictures

3 views (last 30 days)
James Timana
James Timana on 28 Oct 2011
Answered: mengjiao fan on 13 Apr 2015
hi how can I create a gui that will show different pictures on the same axes but displaying only one at a time automatically

Accepted Answer

Image Analyst
Image Analyst on 28 Oct 2011
Define "automatically." Do you mean in a for loop? See the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F so you'll know how to do stuff like this:
filePattern = fullfile(myFolder, '*.jpg');
jpegFiles = dir(filePattern);
for k = 1:length(jpegFiles)
baseFileName = jpegFiles(k).name;
fullFileName = fullfile(myFolder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
imageArray = imread(fullFileName);
imshow(imageArray); % Display image.
drawnow; % Force display to update immediately.
promptMessage = sprintf('Do you want to Continue or Cancel?');
button = questdlg(promptMessage, 'Continue', 'Continue', 'Cancel', 'Continue');
if strcmpi(button, 'Cancel')
break;
end
end
  1 Comment
James Timana
James Timana on 29 Oct 2011
Thanks i will put it to practice

Sign in to comment.

More Answers (1)

mengjiao fan
mengjiao fan on 13 Apr 2015
very useful. I also want to know how to make a time to control

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!