Simulink仿真入门到精通(六) Simulink模型保存为图片

6.1 截图保存方式

Ctrl+Alt+A

6.2 拷贝视图方式

Edit→Copy Current View to Clipboard

6.3 saveas函数

用于保存figure或者simulink框图。

saveas(h,'filename.ext')%直接将句柄h所表示的对象保存到filename.ext文件中
saveas(h,'filename','format')%将句柄h所表示的对象以format的格式保存到名为filename的文件中
后缀名 格式说明 后缀名 格式说明
ai Adobe Illustrator pbm Portable bitmap
bmp Windows位图 pcx Paintbrush 24位(不支持Simulink模型)
emf Enhanced metafile pdf Portable Document Format
eps EPS Level 1 pgm Protable Graymap
fig MATLAB图像(不支持Simulink模型) png Portable Network Graphics
jpg JPEG image(不支持Simulink模型) ppm Protable Pixmap
m MATLAB file(不支持Simulink模型) tif 压缩的TIFF图像

示例:

>> h=get_param(gcs,'handle')

h =

    4.0002

>> saveas(h,'example','png')

多格式保存:

formats = {'bmp','emf','eps','pbm','pdf','pgm','png','ppm','tiff'};
name = 'simulink_saveas';
for ii = 1:length(formats)
    saveas(get_param(gcs, 'handle'),name, formats{ii});
end

6.4 print函数

>> print('-s')
>> print('-smymodel')
>> print('-smymodel','-dbmp','1')

-d支持的格式包括'bmp','eps','pbm','pdf','pgm','png','ppm','tiff'。

原文地址:https://www.cnblogs.com/dingdangsunny/p/12246237.html