我正試圖做的matlab,用戶輸入點作爲輸入和它們之間的連接的GUI。matlab gui - 調用相同的GUI屏幕
我有5個MATLAB文件 - screen1.m,screen2.m,screen3.m,screen4.m,globalParams.m
在globalParams中我有全球PARAMS,所以我可以使用他們從屏幕GUI篩選GUI 。在screen1中用戶輸入節點數量(例如5)。當他按Next按鈕時,回調函數調用「screen2();
」。在screen2.m中,用戶輸入(x,y)座標,當他按Next按鈕時,回調函數調用「screen3();
」。
現在我要求他填充節點i和節點j之間的連接(他需要填充節點i和j的編號)。如果只有1個連接,他將按下完成按鈕,並且回調函數將調用「screen4();
並且效果很好。否則(有多於1個連接)他按Next按鈕並且回調函數調用」screen3();
「。 所以,當我們有超過1個方面,我有問題再打電話給SCREEN3 ..。
也就是在那裏當我打電話下一屏幕關閉的最後一個屏幕某種方式? 因爲當我們找到了一次又一次地調用screen3,將會有很多GUI被打開,並且可能會混淆和惹惱用戶。
一些代碼:
在屏蔽1,下一個按鍵:
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
screen2();
在畫面2
,下一個按鍵:
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
screen3();
在SCREEN3
,下一個按鈕,然後結束按鈕:
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
screen3();
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
screen4();
screen3我如何使用2個節點之間的連接:
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double
global hopsMatrix;
i = str2num(get(handles.edit2, 'string'));
j = str2num(get(handles.edit1, 'string'));
hopsMatrix(i,j) = 1;
爲什麼它是一個問題,再次調用'screen3()'?是否有錯誤,不起作用? – scenia
它只是不再調用screen3 ..它只是做一件事 –
是否有一個特定的原因,你爲什麼要評估你的數據在edit2回調?如果沒有,去看看我的答案是一個更強大的方法。 – scenia