How to share variables across GUIs?
조회 수: 3 (최근 30일)
이전 댓글 표시
As it said in title,there is a variant Num1 in GUI1, I hope that in GUI2 Num1 can changged, how ? Thank you!
댓글 수: 2
Jan
2012년 11월 21일
What does "variant Num1 in GUI1" exactly mean? Is this the tag of an uicontrol, a variable in the application data set by guidata() or a field in a struct stored in the UserData?
채택된 답변
Arthur
2012년 11월 21일
I prefer to store and share data with the function setappdata and getappdata. This is, in my opinion, more clear and better structured.
댓글 수: 0
추가 답변 (1개)
Walter Roberson
2012년 11월 21일
If you used GUIDE, you need to use guidata() on the figure number for GUI2 in order to get GUI2's handle structure in GUI1. Then you can change things in the normal way. For example,
handles2 = guidata(GUI2_figure);
set(handles2.Num1, 'Value', get(handles.Num1, 'Value'))
참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!