Some help in an application of Callback uicontrol-Properties

4 visualizaciones (últimos 30 días)
Marco
Marco el 19 de Dic. de 2012
Hi,
I have an uicontrol as pushbutton
S.push = uicontrol('Style', 'togglebutton', 'String', 'push', 'Callback', @funz1);
S.push = uicontrol('Parent', S.fig, 'Style', 'pushbutton', 'String', 'push', 'Callback', @func);
it is not inside any function
where S.fig is the parent-figure that includes other handle objects. Some of these are editable tables as:
S.mastab = uitable('Parent',S.fig, 'Data', masdat, 'ColumnEditable', true);
where masdat is a matrix (initial values of Data).
Can someone explain me, please, how can I make the function in Callback (called @func) in the pushbutton handle for get 'Data' Property from S.mastab table like:
data = get(S.mastab, 'Data')
???
Besides, have I to make such function in an other m-file ?
Thanks

Respuestas (1)

Walter Roberson
Walter Roberson el 19 de Dic. de 2012
The easiest way would be to make a slight change to the way you define S.mastab
S.mastab = uitable('Parent',S.fig, 'Data', masdat, 'ColumnEditable', true, 'Tag', 'mastab');
Then your func could be
function func(src, event)
thisfig = ancestor(src, 'figure');
S.mastab = findobj(thisfig, 'Tag', 'mastab');
  2 comentarios
Matt Fig
Matt Fig el 19 de Dic. de 2012
Or use
gcbf
Or one could save S, assuming S has all the handles, in GUIDATA then call GUIDATA inside the callback.
Marco
Marco el 19 de Dic. de 2012
But where is S.mastab 'Data' ?
Is it inside some variable?

Iniciar sesión para comentar.

Categorías

Más información sobre App Building en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by