addlistener for an array

4 次查看(过去 30 天)
rmc256
rmc256 2011-8-30
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.

回答(1 个)

Walter Roberson
Walter Roberson 2011-8-30
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.

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by