addlistener for an array
1 view (last 30 days)
Show older comments
In a GUI, I would like a function to be called whenever a certain variable stored in "handles" is changed (handles.times lets say). I tried using addlistener() directly on an array, which doesn't work. I think I can create a class and do it that way, but it seems like a lot. I'm looking for SPECIFIC examples. Reasoning for this is I have a GUI that is a slave GUI to a master GUI. Whenever a certain value changes in the slave, I want it to automatically update the master GUI.
0 Comments
Answers (1)
Walter Roberson
on 30 Aug 2011
It might be easier to write a small wrapper routine such as
function handles = updatehandles(handles, field, value)
handles.(field) = value;
guidata(handles.mastergui, handles);
end
and then use updatehandles() instead of a plain assignment.
0 Comments
See Also
Categories
Find more on Multidimensional Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!