필터 지우기
필터 지우기

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

조회 수: 1 (최근 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 CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by