Calling a GUI from another GUI. Problem with output variable being overwritten.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Ashleen Hayes
el 28 de Feb. de 2017
Comentada: Ashleen Hayes
el 28 de Feb. de 2017
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 comentarios
Adam
el 28 de Feb. de 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.
Respuesta aceptada
Adam
el 28 de Feb. de 2017
Editada: Adam
el 28 de Feb. de 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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Whos en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!