How can I change the default Stateflow chart properties?
22 views (last 30 days)
Show older comments
MathWorks Support Team
on 25 Oct 2012
Edited: MathWorks Support Team
on 5 Dec 2018
For example, I want to set the default chart property "Use Strong Data Typing with Simulink I/O" to be checked, so when I create a new Stateflow chart, this property is checked.
Accepted Answer
MathWorks Support Team
on 5 Dec 2018
Edited: MathWorks Support Team
on 5 Dec 2018
There are two ways to change the default Stateflow chart properties:
-----------------------
1. Using the Stateflow API
Run the following code after starting MATLAB:
load_system('sflib');
set_param('sflib','Lock','off')
rt = sfroot;
m = rt.find('-isa','Stateflow.Machine','Name','sflib');
chart = m.findDeep('Chart');
chart.StrongDataTypingWithSimulink = 1;
Remark: For newer releases change the last line to:
chart(1).StrongDataTypingWithSimulink = 1;
When you open a new Stateflow chart, the chart property "Use Strong Data Typing with Simulink I/O" will be checked. You can change other default properties using the similar methods. More information on Stateflow API can be found at:
You can also save the above code to the file startup.m. It will take effect automatically every time when you start MATLAB. More information on setting the file startup.m can be found at:
Please be aware that you manually change the Stateflow library without saving.
-----------------------
2. Using the Simulink Library Browser
Type the following in the MATLAB command window:
simulink
Click on "Stateflow" on the Simulink Library Browser tree, then double click the "Chart" block. Right click on the opened chart, select "Properties". Check the option "Use Strong Data Typing with Simulink I/O" and close the chart. (Note: Do not save the chart unless you want to change the chart property permanently, which is not recommended.) After doing this, if you open a new Stateflow chart, the chart property "Use Strong Data Typing with Simulink I/O" will be checked.
0 Comments
More Answers (0)
See Also
Categories
Find more on Syntax for States and Transitions in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!