Expert needed / event function

3 ビュー (過去 30 日間)
Max Müller
Max Müller 2014 年 8 月 28 日
回答済み: Max Müller 2014 年 8 月 28 日
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 ?

回答 (2 件)

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

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by