Question

I see there have been many questions about this topic, but I cannot seem to figure it out.

I want to move my slider, and update my image stack as I do so. I currently have it so that I can view the stack, by changing the left and right hand arrows. But, as I drag the slider, I would like to drag through the stack and continuously update the axes.

% --- Executes on slider movement.
function Slider_Callback(hObject, eventdata, handles)

imshow(handles.FloatArray(:,:,get(handles.Slider,'Value'))); % Update axes when pressing
axis(handles.Axes, 'on');                                    % left & right slider buttons

I believe (from what I have read) I need to implement an addlistener? I am unsure how to do this, and the MATLAB help page leaves me more confused.

Any guidance would be much appreciated.

Was it helpful?

Solution

Nothing beats a good example

fh = figure;
s = uicontrol('style','slider','parent',fh,'callback',@Slider_Callback);
addlistener(s,'Value','PostSet',@(s,e)Slider_Callback(fh));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top