필터 지우기
필터 지우기

How to trace the matlab callbacks in stateflow GUI events

조회 수: 1 (최근 30일)
jagpreet  makkad
jagpreet makkad 2015년 4월 14일
편집: Alexander Wille 2015년 6월 16일
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?

채택된 답변

Vishnu Nair
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
jagpreet  makkad
jagpreet makkad 2015년 4월 16일
편집: jagpreet makkad 2015년 4월 16일
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

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Vishnu Nair
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
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:
  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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Stateflow에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by