我正在Matlab中開發一個GUI,我想知道單擊按鈕時的工作流程。更具體一點,我想知道當我點擊一個按鈕時會發生什麼,因爲它的回調沒有被觸發。GUI工作流命令
Q
GUI工作流命令
1
A
回答
0
如果使用GUIDE
開發,每次添加一個按鈕,你的GUI
生成的代碼塊:
% --- Executes on button press in pushbutton1.
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)
該功能被稱爲每次按下該按鍵的時間。所以,如果你點擊按鈕時需要執行某些操作,只需要在生成的代碼塊下面添加要執行的代碼行即可。例如,假設你有一個edit text
變量稱爲edit1
與價值
edit1 = 'hello';
如果你想用它,你需要調用handles
互動,但首先你需要創建一個全局變量:
%set the current figure handle to main application data
setappdata(0,'figureHandle',gcf);
%set the handles to figure's application data
setappdata(gcf,'EDIT1',handles.edit1);
然後,在你的按鈕的回調函數,你需要寫:
% --- Executes on button press in pushbutton1.
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)
figureHandle = getappdata(0,'figureHandle');
EDIT1 = getappdata(figureHandle,'EDIT1 ');
new_string = 'updated string';
set(EDIT1, 'String', new_string);
希望這有助於
相關問題
- 1. HTA作爲命令行GUI
- 2. Openstack Neutron命令工作流程
- 3. 流浪了命令不工作
- 4. ffmpeg流偏移命令(-itsoffset)不工作
- 5. 詹金斯shell命令工作流程
- 6. 流浪命令停止工作:找不到命令上的WIndows
- 7. 將GUI附加到命令行工具
- 8. cvim命令不能在命令模式下工作,但可以從GUI菜單中工作
- 9. 通過Windows命令行操作GUI
- 10. BeanShell PostProcessor錯誤Jmeter GUI工作,命令行不行
- 11. java命令工作,但javac命令不?
- 12. 工作流生命週期?
- 13. 複合命令不工作
- 14. 睡眠命令不工作
- 15. TortoiseHG工作臺命令
- 16. 的setcookie命令不工作
- 17. PHP Cron工作命令
- 18. SED命令不工作
- 19. Windows cmd。命令doens't工作
- 20. CKEditor的命令不工作
- 21. jQuery命令不工作
- 22. pstack命令如何工作?
- 23. 命令工作,在PHP
- 24. .upper命令不工作
- 25. rails命令不工作
- 26. 「gradlew蝕」命令不工作
- 27. Runtime.exec命令不工作
- 28. 按鈕命令不工作
- 29. 命令如何工作?
- 30. 綁定命令不工作
你的意思是標準按鈕,如縮放等等?如果你知道發生了什麼,請寫下一些內容。我也會感興趣。 +1 – patrik