How to run two ".m" files in a single GUI using pop-up menu and push button in GUI?

5 ビュー (過去 30 日間)
RAJESH
RAJESH 2014 年 2 月 19 日
編集済み: Dishant Arora 2014 年 2 月 19 日
How to run two ".m" files in a single GUI using pop-up menu and push button in GUI?
GUI layout :- I have one pop-up menu with two options. One push button and an axes to display output image.
Problem:-After selecting one option, when i click push button the output should be displayed on axes. There are two different ".m" programs for two options in pop up menu. But it has to be executed only after clicking push button.
Can anyone help me!!!!

回答 (1 件)

Dishant Arora
Dishant Arora 2014 年 2 月 19 日
編集済み: Dishant Arora 2014 年 2 月 19 日
function popupmenu1_Callback(hObject, eventdata, handles)
val = get(hObject,'Value');
setappdata(0,'popupIndex',val);
function pushbutton_callback(hObject, eventdata, handles)
popupIndex = getappdata(0,'popupIndex')
switch popupIndex
case 1
yourProgramName1 % don't forget to pass on the parameters if it's a function
case 2
yourProgramName2

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by