How do I save changes to handles after calling a helper function in GUI?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I know that to save GUI information you do guidata(hObject, handles) after a change however this does not seem to work when you call a helper function within a callback. For instance, I have a toolbar icon and a menu tab to let the user open an image. Since both are practically the same exact code I thought I would write them as wrapper functions to a helper funciton Open() which takes as parameters (hOjbect, handles). When I call guidata(hObject, handles) in each individual callback it works perfectly but with the same exact code transferred to the helper function (including the guidata(hObject, handles)) it does not. WHY DOESN'T MATLAB ALLOW POINTERS!!!!!
1 commentaire
Jan
le 24 Juil 2012
Matlab uses a copy on write strategie: As long as the values are not changes, shared copies are used, which could be seen as a kind of pointer.
Réponses (1)
Image Analyst
le 24 Juil 2012
Try returning handles as an output to the functions if you change handles within the function. I.e
function handles = MyFunction(handles, input1, input2, input3) % Function has code that makes use of handles.....
0 commentaires
Voir également
Catégories
En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!