Expert needed / event function

4 visualizzazioni (ultimi 30 giorni)
Max Müller
Max Müller il 28 Ago 2014
Risposto: Max Müller il 28 Ago 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 ?

Risposte (2)

Adam
Adam il 28 Ago 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 il 28 Ago 2014
Thats a good idea. I will try it and post here how i manged to do it.

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by