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

1 view (last 30 days)
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!

Answers (1)

Walter Roberson
Walter Roberson on 28 Dec 2018
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.

Categories

Find more on Graphics Object Identification in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!