How can I programmatically set the enum name of a chart with output port monitoring of child activity?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
When editing a Stateflow chart in the model explorer, there is a number of properties that can be set, such as 'Enable zero-crossing detection' etc. The corresponding object of a Stateflow.Chart (obtained using 'sfgco' or 'find') allows setting all these properties programmatically, except for one: the "Enum name"-property for charts where "Create output port for monitoring" is set to "Child activity". Where can I change that property programmatically?
Note that the "OutputData"-property allows setting the properties of the related output data element, but not the "Enum name"-property of the chart. The following screenshot illustrates the issue. After changing the OutputData.DataType-property, the related output data DataType-property changes, but not the "Enum name"-property of the governing chart.
0 comentarios
Respuestas (1)
Sebastian Castro
el 14 de Jul. de 2015
Editada: Sebastian Castro
el 14 de Jul. de 2015
I think you can use the Stateflow API to do this, though it'll take a little bit of digging. For example:
rt = sfroot;
m = rt.find('-isa','Simulink.BlockDiagram');
ch = m.find('-isa','Stateflow.Chart');
After those weird steps, you can search for the state you're interested in.
mode = ch.find('-isa','Stateflow.State','-and','Name','Mode Definitions and Transition');
Once you have "mode", you can look at the table in this document for all the accessible properties and methods of these so-called "Stateflow.State".
Without having access to MATLAB right now, and looking at the properties in that table, I'd guess you do something like:
mode.LoggingInfo.UserSpecifiedLogName = 'modeName';
... but the easiest thing to do is to check by displaying this "mode" variable and seeing which property name is the one with the Enum name.
Good luck, and I hope I'm on the right track :)
- Sebastian
2 comentarios
Alexander Wille
el 14 de Jul. de 2015
Editada: Alexander Wille
el 14 de Jul. de 2015
Alessio Canepa
el 31 de Dic. de 2016
Hi Alexander, I've the same problem. Did you find a way to set that property progmatically? Thanks
Ver también
Categorías
Más información sobre Graphical 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!