我正在研究一個程序並決定在其周圍構建一個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