Borrar filtros
Borrar filtros

How do I save changes to handles after calling a helper function in GUI?

1 visualización (últimos 30 días)
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 comentario
Jan
Jan el 24 de Jul. de 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.

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 24 de Jul. de 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.....

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by