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

6 visualizaciones (últimos 30 días)
I would like to capture the images of all of my model's charts.

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 21 de Feb. de 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 comentarios
Sriram Narayanan
Sriram Narayanan el 24 de Abr. de 2015
Editada: MathWorks Support Team el 23 de Feb. de 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 el 19 de Jun. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Stateflow en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by