Modify Transition condition of Stateflow with script

6 visualizaciones (últimos 30 días)
Yuntao Zhang
Yuntao Zhang el 11 de Jul. de 2017
Respondida: Yuntao Zhang el 25 de Jul. de 2017
Hello Everyone, Is it possible to modify a transition condition of Stateflow with m-file script? maybe someting similar to set_param? Thanks a lot

Respuesta aceptada

Dimitris Iliou
Dimitris Iliou el 13 de Jul. de 2017
There is a way to modify a transition condition in Stateflow.
To do that, you will need to use the Stateflow API. You can find a quick start guide in the following documentation link:
When you reach step 6 of this example, you will notice that you can modify the LabelString property of the transition. There you can set it equal to a condition. For example:
trans1_2.LabelString = '[u>0]'
assuming that trans1_2 is the transition handle.
Given that, you first need to find that handle. In the following documentation page:
you can find information on how to access Stateflow Objects programmatically. Specifically, the following command:
transArray = sA.find('-isa','Stateflow.Transition');
returns an array of all the transitions. Using that, you can find the handle you are looking for, and then modify the LabelString property to your needs.

Más respuestas (1)

Yuntao Zhang
Yuntao Zhang el 25 de Jul. de 2017
Dimitris, Thanks a lot :)

Categorías

Más información sobre Programmatic Model Editing 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