Clear Filters
Clear Filters

How do I write a GUI to step through a set of images using a Slider in MATLAB 7.9 (R2009b)?

4 views (last 30 days)
I have a set of images in a directory which are all named with a specific format (something.number.fileType) and I would like to be able to load any one of those images in the GUI window and then use a slider to step through the images in sequential order.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 22 Feb 2012
In order to step through images in a directory from a GUI, it is necessary to first load an image, then store the information associated with that file, i.e. the path to the image, the number the image is in the sequence of images, and the image file type, for later use. To do this it is a good practice to use the SETAPPDATA command, which allows you to store data in an object within the GUI. In this case it is reasonable to store the data associated with the image in the axes object since that is what will be used to display the image.
Then a callback function must be written for the slider object which uses the current position of the bar to select and load an appropriate image from the directory located at the path we saved earlier.
Download the attached zip file, unzip it into a new directory, and run the MATLAB file to see a working example of how this can be done.

More Answers (0)

Tags

No tags entered yet.

Products


Release

R2009b

Community Treasure Hunt

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

Start Hunting!