필터 지우기
필터 지우기

Expert needed / event function

조회 수: 1 (최근 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 CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by