How can I access Simulink/Stateflow chartFileNumber from within a Matlab function?

A typical Simulink model file (mdl) with a Stateflow chart looks something like
[..]
Stateflow {
machine {
[..]
}
chart {
[..]
chartFileNumber 1
[..]
}
[..]
}
The contained Stateflow charts have a chartFileNumber property.
I can get access to the Statemachine and Chart objects using the Simulink API.
SL = sfroot;
MDL = SL.find('-isa','Simulink.BlockDiagram');
ch = MDL.find('-isa','Stateflow.Chart'); % give the Chart object
But the chart object does not contain an element representing the chartFileNumber as stored in the mdl-file.
So: How can I access this counter from within an Matlab function (m-file)?
Regards, Jonatan Antoni

2 comentarios

Jonatan: Perhaps you can tell us a little bit about why you need to know that number? Since it is not part of the published API, I would recommend caution in attempting to have code that relies on it. (Personally, I don't know what the significance of that property is, but maybe someone else on this forum will know the answer).
The Simulink/Stateflow (embedded) coder makes use of this counter to name the state variables within the dwork structure. I try to extract the information on available state variables from Stateflow Charts in order to integrate it with custom code, i.e. having the ability to check whether a statemachine is in a certain state. Perhaps there is another way to get this information without directly accessing this property.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Stateflow en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 3 de Jul. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by