문제

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.

도움이 되었습니까?

해결책

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));
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top