How can I print out all of the stateflow charts in my model?
6 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2013 年 2 月 21 日
編集済み: MathWorks Support Team
2022 年 2 月 23 日
I would like to capture the images of all of my model's charts.
採用された回答
MathWorks Support Team
2013 年 2 月 21 日
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 件のコメント
Sriram Narayanan
2015 年 4 月 24 日
編集済み: MathWorks Support Team
2022 年 2 月 23 日
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
2015 年 6 月 19 日
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.
その他の回答 (0 件)
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!