我正在研究一个程序并决定在其周围构建一个GUI。我想从头开始很简单,加载一个电影,并能够滚动浏览。我已经看过很多关于听众的问题,实际上有人问这个问题,但是那里的解决方案似乎对我没有任何作用。在GUI中的我开启功能 我连续滑块侦听器创建一个新的空白图
handles.output = hObject;
handles.sliderListener = addlistener(handles.Image_Slider,'ContinuousValueChange', ...
@(hObject, event) Image_Slider_ContValueCallback(...
hObject, eventdata, handles));
% Update handles structure
guidata(hObject, handles);
And then I have the following two call backs :
function Image_Slider_Callback(hObject, eventdata, handles)
% hObject handle to Image_Slider (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles=guidata(hObject);
current_slice = round(get(handles.Image_Slider,'Value'));
%size(handles.Image_Sequence_Data(:,:,current_slice));
im =imagesc(handles.Image_Sequence_Data(:,:,current_slice),'Parent',handles.Image_Sequence_Plot);
colormap('gray');
的正常工作(不听者的一切行为会正确)
,然后我也有
function Image_Slider_ContValueCallback(hObject, eventdata, handles)
% hObject handle to Image_Slider (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles=guidata(hObject);
current_slice = round(get(handles.Image_Slider,'Value'));
%size(handles.Image_Sequence_Data(:,:,current_slice));
handles=guidata(hObject);
%im =
imagesc(handles.Image_Sequence_Data(:,:,current_slice),'Parent',handles.Image_Sequence_Plot);
colormap('gray');
,我觉得应该叫当滑块连续移动时。我的问题是每次滑块值改变一个空白(“图1”)出现。实际的GUI数据响应正确,但我不明白为什么/这个'流氓'的数字来自哪里..
有人请帮忙。此外,任何意见imshow与imagesc哪个更好(这个GUI将涉及大量的用户与图像交互)
谢谢你的工作完美! – 2014-09-04 00:11:48
非常高兴帮助! – 2014-09-05 01:10:36