How to trace the matlab callbacks in stateflow GUI events
4 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
Vishnu Nair
2015-4-16
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 个)
Vishnu Nair
2015-4-17
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 个评论
Alexander Wille
2015-6-16
编辑:Alexander Wille
2015-6-16
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:
- Different behavior when properties change between setting them through the Stateflow GUI or API
- 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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!