passing data & connecting gui(s)
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, i have 3 gui and i have 3 tab like this file that i upload how can i connect them together
every 3 gui icludes axes, pushbuttom,...
댓글 수: 2
채택된 답변
Jan
2018년 11월 23일
A specific question is more efficient than "I don't understand how it works". The code example contains useful comments already.
% get the handle of Gui1
h = findobj('Tag','Gui1');
Is this clear so far? Each GUI element, e.g. a figure, has a unique "handle", which can be used to access the object. Instead of seaching all GUI elements, e.g. all buttons, lines and menu entries, it is faster to restrict the search to the wanted object:
h = findob(allchild(0), 'flat', 'Tag', 'Gui1');
Now only figures are searched.
% if exists (not empty)
if ~isempty(h)
A matching figure was found.
% get handles and other user-defined data associated to Gui1
g1data = guidata(h);
Now you can access the handles struct of the found figure. Do not get confused by the name "handles". It does contain handles of the GUI elements created by GUIDE, but you can store anything in this struct also.
Now the callback can access all elements of the figure with the tag 'Gui1', e.g. getting the values of toggle-buttons or draw in existing axes.
Search in this forum for "share data between callbacks". This works for callbacks of different figures also.
댓글 수: 1
추가 답변 (0개)
참고 항목
카테고리
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!