Expert needed / event function

4 visualizaciones (últimos 30 días)
Max Müller
Max Müller el 28 de Ag. de 2014
Respondida: Max Müller el 28 de Ag. de 2014
Hey Guys,
is it possible to trigger a fcn when a special command is used ? e.g. Imagine u have got a GUI that gets an Input Array and gives the user the possibility to calculate/Change the Input Array.
Furthermore, imagine the GUI holds an amount of buttons, each representing one calculation type. After the calculation is done, the GUI uses the setappdata() command to make the new Data global for the other buttons.
Question: is it possible to create a fcn that actives it self everytime the command: setappdata is used ?

Respuestas (2)

Adam
Adam el 28 de Ag. de 2014
You could probably just write a wrapper function for setappdata which calls your fcn function immediately after the call to setappdata.
So instead of calling setappdata directly from multiple places just call
setmyappdata( h, name, val )
(but don't name it that, it's just for example!!)
Then:
function setmyappdata( h, name, val )
setappdata( h, name, val );
fcn( args )
You may need to do some other preparation for your call to fcn or use getappdata or whatever it is you need to obtain any arguments your function requires, but that solution should work if I understand what you are asking correctly.

Max Müller
Max Müller el 28 de Ag. de 2014
Thats a good idea. I will try it and post here how i manged to do it.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by