How can I print out all of the stateflow charts in my model?

6 vues (au cours des 30 derniers jours)
I would like to capture the images of all of my model's charts.

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 21 Fév 2013
The following code will iteratively walk through a model's Stateflow charts and use the PRINT command to print the associated figure windows.
The FIND_SYSTEM will look for all SubSystems that are a Stateflow type. Then those charts are made active and visible by the OPEN_SYSTEM command. Then they are saved to the current directory using the PRINT command. This example prints them as Windows EMF files, but the option can be changed to any supported format, as described in the documentation.
shh = get(0,'ShowHiddenHandles');
set(0,'ShowHiddenHandles','on')
Sub_sys = find_system(gcs,'FollowLinks','off','LookUnderMasks','off','SearchDepth',...
1,'blocktype','SubSystem')
for i =1:length(Sub_sys)
if(strcmp(get_param(Sub_sys{i},'Masktype'), 'Stateflow')== 1)
open_system(Sub_sys{i})
print([get_param(Sub_sys{i},'Name') '.emf'],'-dmeta');
close(gcf)
end
end
set(0,'showHiddenHandles',shh)
  2 commentaires
Sriram Narayanan
Sriram Narayanan le 24 Avr 2015
Modifié(e) : MathWorks Support Team le 23 Fév 2022
In R2013a, you can mask a chart, Truth Table block, or State Transition Table block directly. In previous releases, you had to place the Stateflow block in a subsystem, and then mask that subsystem.
In R2013a, MATLAB scripts or functions that rely on the MaskType property of Stateflow blocks need to be updated. For example, get_param(handle_to_SF_block, 'MaskType') now returns an empty value instead of 'Stateflow'.
As a workaround, for backward compatibility, use FIND_SYSTEM functionality of MATLAB which returns all the Stateflow blocks:
find_system('MaskType','Stateflow')
However, as a better practice, use the Stateflow API instead. See “Overview of the Stateflow API” using the below link. Do not create masks with Mask Type "Stateflow", because it makes the behaviour unpredictable. Stateflow API is the best option here.
Sriram Narayanan
Sriram Narayanan le 19 Juin 2015
It is not possible to directly query just the transitions without truth table transitions currently. You would have to extract the transitions from the transarray object that you desire to use.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Stateflow dans Help Center et File Exchange

Tags

Aucun tag saisi pour le moment.

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by