How to update the slider when I need to show different series of images (MATLAB GUI, not programmed)
2 views (last 30 days)
Show older comments
Hello. I have a problem when using the slider to update my images. I have a series of images. I first use the slider to update the images. It works. After some crop of the first series of images, I got another series of images. I wonder When I change my images to the series 2. How to update the slider. Because when I push the slider, it still update the first series images. Thank you.
3 Comments
Image Analyst
on 24 Feb 2017
And show a screenshot. I don't even have any idea if you're just dispalying one image at a time, or the whole series simultaneously. And what does "update" mean? Does it mean you just display one of the images, or does it mean that you use the slider value to apply some mathematical operation on the image data?
Accepted Answer
Geoff Hayes
on 25 Feb 2017
Pan - since your slider2_Callback uses the images from handles.Img, then either you will need to replace them with the Img_2 set of images or use a different field within handles to manage the images to be used by this callback. For example, when you initialize handles.Img, then also initialize another field as
handles.sliderImages = handles.Img;
Then your slider callback would do
function slider2_Callback(hObject, eventdata, handles)
Img = handles.sliderImages;
% etc.
And when you initialize handles.Img_2, then you would replace the sliderImages too
handles.sliderImages = handles.Img;
Note that each time you update these images for the slider, you would then update the Min, Max, and SliderStep
set(handles.slider2,'Min',1,'Max',SIZE_Z);
set(handles.slider2,'SliderStep',[1/(SIZE_Z-1),1/(SIZE_Z-1)]);
(rather than updating these values within the callback) where SIZE_Z is the number of images in sliderImages.
3 Comments
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!