How to trace the matlab callbacks in stateflow GUI events

1 view (last 30 days)
I am trying to trace the matlab callback functions when creating new stateflow objects, creating new transitions, changing name of States etc.But I could find only solution for normal matlab GUI. Using below command I got the graphical handle of stateflow object: >>obj=sfgco; >>HG=findobj(obj); and using this graphical handle I could call DeleteFcn callback function. >>set(HG,'DeleteFcn','myCallback') when am deleting my object myCallback being called.But I have only three callback functions available.They are DeleteFcn,CreateFcn and ButtonDownFcn.How to find all callback functions are being called by Stateflow objects when creating,dragging,changing name?

Accepted Answer

Vishnu Nair
Vishnu Nair on 16 Apr 2015
Hi Jagpreet... I think you can listen the property change in the stateflow GUI objects like states,transition etc using handle.listener. >>handle.listener(Obj,'prop','PropertyPostSet',@mycallback) I hope this will work....
  1 Comment
jagpreet  makkad
jagpreet makkad on 16 Apr 2015
Edited: jagpreet makkad on 16 Apr 2015
Thanks vishnu....it's working.....but having problem when i am changing the name of a particular state manually it is not being considered as an event but whn i am changing the name using set command, callback function is being called.....why is it so?? Thank you in advance

Sign in to comment.

More Answers (1)

Vishnu Nair
Vishnu Nair on 17 Apr 2015
Hi Jagpreet. I understand your problem.You can change properties by right click properties as well.But for your intention you have to get help from mathwork team or the expert in matlab stateflow gui design.I hope that you will get this answer.
  1 Comment
Alexander Wille
Alexander Wille on 16 Jun 2015
Edited: Alexander Wille on 16 Jun 2015
I have the same problem. In order to trigger a callback when a state or transition is created or deleted, a property to attach the listener to. But that is not possible because there is no "downtrace"-property from the chart to its states.
We may be having two issues here:
  1. Different behavior when properties change between setting them through the Stateflow GUI or API
  2. The lack of a hook for Stateflow object creation and deletion in the Stateflow API.
I will file a support ticket and keep you posted.
Edit: I considered listening to the "Dirty"-property, but obviously it only changes with the first edit to the Stateflow.Chart or its children. With triggering a model save in the callback, this could serve as the basis of a workaround, but at the cost of saving after every little change, which can affect performance very badly.

Sign in to comment.

Categories

Find more on Stateflow in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!