H must be the handle to a figure or figure descendent??

1 回表示 (過去 30 日間)
Le Dung
Le Dung 2018 年 12 月 26 日
回答済み: Walter Roberson 2018 年 12 月 28 日
Hi everyone!
My problem is:
I have twos GUIs, GUI1 and GUI2.
GUI2 is sub - GUI of GUI1 that mean when i click on any component in GUI1, GUI2 will be opened
And, i want to use data in GUI1 for GUI2. i use code below in function GUI2_OpeningFcn(hObject, eventdata, handles, varargin) of GUI2
function GUI2_OpeningFcn(hObject, eventdata, handles, varargin):
hgui1 = findobj('Tag','gui1') % i set 'Tag' for GUI1 is "gui1'
if ~isempty(hgui1)
% get handles and other user-defined data associated to Gui1
gui1data = guidata(hgui1); % Store data from hgui1 to gui1data handle
end
guidata(hObject, handles);
when GUI2 runs, matla returns:
Error using guidata (line 87)
H must be the handle to a figure or figure descendent.
I don't know why?
Could you help me?
Please!

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 12 月 28 日
We have been discussing this in https://www.mathworks.com/matlabcentral/answers/11738-set-handles-of-another-gui#comment_654592 where I am waiting for your response on some debugging steps.
At the moment the difficulty is that your hgui1 is returning multiple figures. I need more information from you to figure out why it is happening.

カテゴリ

Help Center および File ExchangeGraphics Object Identification についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by