Simulink API: Identify SF blocks with 'User specified states/transition execution order' set 'ON'

4 views (last 30 days)
Hi all, I would like to write a script which helps me to identify stateflow blocks in my models where certain settings were made (e.g. find all stateflow charts where 'User secified states/transition execution order' is set to ON). I would like to use this script to proof for a review that certain settings were not used in my model etc.
I tried to do it with the find_system() command. But I don't know what parameter to use in this function to identifiy stateflow charts.
It would be easy to identify all gain blocks in my model - the correct command to show all locations would be: find_system(gcs, 'BlockType', 'Gain')
However I saw that this does not work that easy for searching stateflow blocks. If I click on a stateflow chart and do a get_param(gcb, 'BlockType') the return is 'SubSystem' - so it seems that there is no unique Blocktype for stateflow charts, it is only treated as subsystem.
The next step after detection of all statefow charts would be to identify those where parameter 'User specified states/transition execution order' was set to ON. I also don't know how to do that.
Does anybody know how to do that , or is there another solution ?
--- Is there maybe a global switch where 'User secified states/transition execution order' can be switched ON/OFF for the whole model. A compare of the generated code with/without that switch could identify where the setting is used and where it takes effect.
---
Thanks for your help, Rolf

Answers (1)

Guy Rouleau
Guy Rouleau on 16 Jan 2013
Try the Stateflow API
You should be able to find any/all charts in a model with this API and get/set its properties.
  1 Comment
Rolf
Rolf on 17 Jan 2013
Hi Guy. Thanks for the hint. Here is what I made out of it:
chroot = sfroot; %% Get handle to the SF root object charts = chroot.find('-isa','Stateflow.Chart')
for i=1:1:size(charts,1) if (charts(i).UserSpecifiedStateTransitionExecutionOrder) disp(' '); disp ( '** WARNING - UserSpecStateTransExecOrder active in'); disp (['** chart : ',(charts(i).Name)]); disp (['** used in: ',(charts(i).Path)]); disp '**Please review explicitly the trans exec order there.'; end end

Sign in to comment.

Categories

Find more on Modeling 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!