- Save their current default setting
- Change the Stateflow action language to "C"
- Restore the previous default language at the end of the script
How to disable warning for Stateflow action language
2 views (last 30 days)
Show older comments
I am working on a script which temporarily adds content to a Simulink model, builds the model, then removes the new content. I recently started adding a few Stateflow diagrams to these models, and I use the C action language in these diagrams. My script can add the Stateflow and then change the action language to C, but I cannot find a way to do both of these things in a single command line, so the Stateflow temporarily exists with the default m-script action language.
Here's the problem. For MatLab 2015B users of this script, the following warning appears at the top of the active Simulink window:
"You are adding a chart '...' that uses MATLAB as the action language to the model. Click here to change the action language to C. To always add a C chart henseforth, click here. Learn more"
The next two lines of my script change the action langue to C, but it is too late to prevent the warning from being displayed. Other people run this script, and I do not want to change their default settings. Any suggestion on how I can disable this warning, either by adding the Stateflow chart as a C action language in one line, or by temporarily disabling the warning?
0 Comments
Accepted Answer
Michelle Wu
on 30 Jan 2017
It does not seem possible to disable the warning. If you will be using C as the action language throughout the whole model, it looks safer and easier to me to first set the correct action language before adding a new Stateflow chart. I understand that you would like to avoid changing default action language on other people's machine, but a possible workaround could be:
The code that does the job should look like:
curLanguage = sfpref('ActionLanguage'); % save the user's current language
sfpref('ActionLanguage','C'); % set the default language to C
% Your code ...
sfpref('ActionLanguage', curLanguage) % restore to previous setting
More Answers (0)
See Also
Categories
Find more on Complex Logic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!