How can I programmatically set the enum name of a chart with output port monitoring of child activity?
5 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Sebastian Castro
2015 年 7 月 14 日
編集済み: Sebastian Castro
2015 年 7 月 14 日
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 件のコメント
Alessio Canepa
2016 年 12 月 31 日
Hi Alexander, I've the same problem. Did you find a way to set that property progmatically? Thanks
参考
カテゴリ
Help Center および File Exchange で Graphical Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!