Neat problem. Here's what you can do:
- At program startup, use dir, (like this:
filelist = dir('*.bmp')
) to get a list of all of the image files in the folder in which you are working. - Assign that list to the guidata handles, like so:
handles.filelist = filelist
. While your at it, add another handle value to hold your current image index,handles.frameindex = 1
, you'll need this later. Don't forget to update guidata afterwards! In the pressed callback function of your pushbutton, do something like this:
filelist = handles.filelist; frameindex = handles.frameindex; currentframefile = filelist(frameindex); handles.frameindex = frameindex+1;
Use the currentframefile, which is a string containing the name of the current frame, with your existing GUI.
This should answer your question, if I understand it correctly. Let me know if you need clarification. Good Luck!