[英]Editing one function in GUIDE, changes all functions?
我第一次使用Matlab的GUIDE,我試圖編輯兩個按鈕功能之一(都打開一個圖像),但是編輯一個按鈕會全部更改。 這是一些代碼:
% --- Executes on button press in Floating.
function Floating_Callback(hObject, eventdata, handles)
clc;
axes(handles.axes1);
[Float, PathName, FilterIndex] = uigetfile('*.bmp');
if(Float ~= 0)
Floating = fullfile(PathName, Float);
FloatArray = imread(Floating);
imshow(FloatArray);
axis on;
end
% Update handles structure
guidata(hObject, handles);
% hObject handle to Floating (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in Reference.
function Reference_Callback(hObject, eventdata, handles)
clc;
axes(handles.axes2);
[Ref, PathName, FilterIndex] = uigetfile('*.bmp');
if(Ref ~= 0)
Reference = fullfile(PathName, Ref);
ReferenceArray = imread(Reference);
image(ReferenceArray);
end
% Update handles structure
guidata(hObject, handles);
例如,
image(ReferenceArray)
將在RBG中打開圖像,但是
imshow(FloatArray)
將以灰度打開(我也不明白為什么會這樣)。 但是我主要關心的是開放之后
imshow(FloatArray)
另一張圖像將自動變為灰度。 我很困惑...另外,據我所知,這些圖像已經是灰度的,至少當我在MS paint或ImageJ中打開它們時,它們才是灰度的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.