Set handles of another GUI?

조회 수: 2 (최근 30일)
Kyle
Kyle 2011년 7월 16일
편집: Le Dung 2018년 12월 28일
Hi,
Is there a way to set handles of another GUI? I have a main GUI which prompt a sub GUI. In the sub GUI,when a button is pressed and it will set the main GUI visible off.
set(handles.fig1,'Visible','off');
I place this code on the the button of my sub GUI. fig1 is the handles of my main GUI. However to code has error because the sub GUI doesnt know the handles fig1.

채택된 답변

Walter Roberson
Walter Roberson 2011년 7월 16일
Set the Tag parameter for the main GUI's figure, and then in the sub-GUI
handles.fig1 = findobj(0,'Type','figure','Tag','TheTagYouSet');
  댓글 수: 7
Walter Roberson
Walter Roberson 2018년 12월 27일
Try
close('all')
now run your program again and see what comes up.
If it still shows multiple items in hgui1 then try
hgui1 = unique(findobj('Tag','gui1'))
If that still returns multiple entries, please show the output of
struct2cell(get(hgui1))
Le Dung
Le Dung 2018년 12월 28일
편집: Le Dung 2018년 12월 28일
dear walter.
thank you again for your reply.
its very kind of you.
i don’t know why matlab return a array that has many figures.
but, i solved my problem when i use:
gui1data = guidata(hgui1(1)).
my code worked ok

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by