Calling a GUI from another GUI. Problem with output variable being overwritten.
1 view (last 30 days)
Show older comments
I currently have a GUI, Main, that will call another GUI, More. More is called and opened on a button press in Main and it shows a list of variables. This list can have more variables added to it and the list is saved to a cell array. More needs to output this array back to Main when the button Done is pressed.
Right now, More works on its own to take an initial input array, put it in the listbox, and can have more added to the array and listbox. It will also correctly output the new array of all the values in the listbox.
The problem comes when I run Main and call More. The inputs work fine and More can have variables added to it but once Done is pressed and More is closed, the array is completely overwritten. It's like Main re-initializes the array after More is closed.
If anyone can help me fix this, it would be greatly appreciated!
2 Comments
Adam
on 28 Feb 2017
You haven't given any information on the crucial part of the operation - i.e. how you implemented the part where clicking 'Done' transfers the data back to the main GUI.
Accepted Answer
Adam
on 28 Feb 2017
Edited: Adam
on 28 Feb 2017
Judging from what you are saying and the symptoms, without seeing the whole code, I suspect you are missing a
guidata( hObject, handles )
(or equivalent) line after calling your More GUI and assigning its results into handles. Without this line the copy of handles you have in the function you launch your 2nd GUI from will just go out of scope and you will still have the original version of handles with the old 'array' field on it.
More Answers (0)
See Also
Categories
Find more on Whos in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!