how to display string's edit box and string's popup when i go back from GUI2 to GUI1

3 ビュー (過去 30 日間)
Jacopo
Jacopo 2014 年 5 月 19 日
コメント済み: Jacopo 2014 年 5 月 19 日
I have created two GUI ( GUI1 and GUI2). In the first (GUI1) I have two edit text in which I insert numerical values ,two pop-up menu, and a callback function "forward" that brings me to the next GUI (GUI2) that contains two radio buttons, two list-box and two functions callback (a GUI allows you to go to the next (GUI3), the other to return to the previous GUI (GUI1)). But when I select the pushbutton 'back' in the second GUI (GUI2) (function_ pushbutton_ indietro_callback), to return to GUI1, the values contained in the edit text of the GUI1 not remain saved (empty cell,as if I had never entered the numeric value) as well as the selections made in the pop-up menu (always in gui1).However, the variables inserted and the initially selected strings are stored in the workspace. I wanted to know, kindly, as I see in the GUI1 the values entered in the edit text and the string selected in the pop-up menu when I get back from GUI2 to GUI1?
Thank you for your cooperation.
  1 件のコメント
Jacopo
Jacopo 2014 年 5 月 19 日
The variables contained in gui1 are saved in the workspace by:
assignin ('base', 'var_1' var_1);
and saved by:
save info_GUI1 var_1 var_2 etc ....
and loaded into the GUI by following:
load info_GUI1
Surely the method I used is not the most correct, but I'm not very experienced ...sorry...

サインインしてコメントする。

回答 (2 件)

Roberto
Roberto 2014 年 5 月 19 日
All depends how your data is saved and passed between the different GUIs, start reading HERE or HERE it's a good way to start.
Or to make it simple, you can use parameters when calling a function to create the GUIs, here's a general idea of to do this!!! in this example you can share the data between two GUIs...
myGUI_1.m
function myData = myGUI_1(inputData)
if isempty(inputData)
myData = 0 ;
else
myData = inputData ;
end
hFigure = figure ;
guidata(hFigure,'myData');
end
myGUI_2.m
function myData = myGUI_2(inputData)
if isempty(inputData)
myData = 0 ;
else
myData = inputData ;
end
hFigure = figure ;
guidata(hFigure,'myData');
end
But again, it depends on what you want to do and how your app data is configured!!!
  1 件のコメント
Jacopo
Jacopo 2014 年 5 月 19 日
The variables contained in gui1 are saved in the workspace by:
assignin ('base', 'var_1' var_1);
and saved by:
save info_GUI1 var_1 var_2 etc ....
and loaded into the GUI by following:
load info_GUI1
Surely the method I used is not the most correct, but I'm not very experienced ...sorry...

サインインしてコメントする。


Sara
Sara 2014 年 5 月 19 日
You can write a function that sets the values in GUI1 when it is called from GUI2, i.e. something that does:
set(handles.myeditbox,'string',handles.myvalue)
  1 件のコメント
Jacopo
Jacopo 2014 年 5 月 19 日
The variables contained in gui1 are saved in the workspace by:
assignin ('base', 'var_1' var_1);
and saved by:
save info_GUI1 var_1 var_2 etc ....
and loaded into the GUI by following:
load info_GUI1
Surely the method I used is not the most correct, but I'm not very experienced ...sorry...

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by