How to trace the matlab callbacks in stateflow GUI events

4 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

Vishnu Nair
Vishnu Nair el 16 de Abr. de 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 comentario
jagpreet  makkad
jagpreet makkad el 16 de Abr. de 2015
Editada: jagpreet makkad el 16 de Abr. de 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

Iniciar sesión para comentar.

Más respuestas (1)

Vishnu Nair
Vishnu Nair el 17 de Abr. de 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 comentario
Alexander Wille
Alexander Wille el 16 de Jun. de 2015
Editada: Alexander Wille el 16 de Jun. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by