Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

How can I properly communicate and edit real-time with master and child structs using GUIDE?

3 vues (au cours des 30 derniers jours)
Ethan
Ethan le 14 Avr 2013
Clôturé : MATLAB Answer Bot le 20 Août 2021
Hey, first time poster! This site is very useful for asking questions. I'm doing an assignment for my engineering class (we get to figure out a lot of stuff on our own) and I have been experimenting. Currently, I have a master GUI or parent GUI that has 4 "kids". These kids modify values in the parent struct as well however I am not sure how to properly modify these values. Only one GUI is visible at a time, however.
Originally I thought simply calling the parent and kids by using:
WEIGHTSANDBALANCE('CALLBACK',hObject,eventData,handles,...)
, things like that. However, this always brought the Singleton to the front even when Visibility was set to off.
I decided that the next best thing to do was to have the parent simply have child structs inside the structure itself. This means to modify children it'd be something around
set(handles.WeightsAndBalanceHandles.text,'String','Testing stuff, man')
This works perfectly however the child cannot talk to the parent because it causes a recursion issue and MATLAB yells at me. Is there any way around this? Perhaps there's some way to do this properly that I don't understand? Thanks
  7 commentaires
Ethan
Ethan le 16 Avr 2013
If I were to use getappdata(0,...) and modify it then resave would it change the handles in the GUI I used with it originally? For example, if I did setappdata(0,'GUIA',handles) and in GUI B I did x = getappdata(0,'GUIA'), modify it then set it again as setappdata(0,'GUIA',x) would GUIA reflect those changes? Forgive my newness :)
Jing
Jing le 3 Mai 2013
Yes, GUIA is the name for handles in your case, once you change the value for GUIA, it'll reflect changes.

Réponses (1)

Yao Li
Yao Li le 16 Avr 2013
I'm not quite sure what you want. But can your problem be fixed if some variables are saved to the 'base' workspace? If it works, use assignin() to assign the variables to the workspace and use evalin() to import the varaibles from workspace to the callbacks
  3 commentaires
Yao Li
Yao Li le 16 Avr 2013
I remembered there was someone solved a similar problem last week, but I can't find it now.

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by