2.2. Batch Processing(图片保存“批处理”)filename
一、用法解析
print(figure_handle,\'formats\',\'-rnumber\',\'filename\')
%将图形保存为formats格式,分辨率为600的(默认为72),最好指定的分辨率大一点,否则保存图形的效果较差.
1.1. 分辨率-rnumber
Use -rnumber to specify the resolution of the generated output.
To set the resolution(分辨率) of the output file for a built-in MATLAB format, use the -r switch.
l For example, -r300 sets the output resolution to 300 dots per inch(每英寸300个点)
The –r switch is also supported for Windows Enhanced Metafiles(增强型图元文件), JPEG, TIFF and PNG files, but is not supported for Ghostscript raster formats(栅格文件).
l For more information, see Printing and Exporting without a DisplayandResolution Considerations.
—— 来自matlab帮助“print”页中
1.2. 输出图片的“格式”formats
请参考本文末尾
二、用法示例
% Save the figure with the handle h to a PostScript file named Figure1, which can be printed later.
H = figure; % 指定图片打印figure_handles
% 若没有figure_handle,则默认print当前显示图片
plot(1:4,5:8)
print(h,\'-dpng\',\'-r200\',\'Figure1\') % 这三行代码就够用了
2.1. 设置输出图片的“图像纵横比”
When you set the axes Position to [0 0 1 1] so that it fills the entire figure, the aspect ratio is not preserved when you print because MATLAB printing software adjusts the figure size when printing according to the figure\'s PaperPositionproperty. To preserve the image aspect ratio(图像纵横比) when printing, set the figure\'s \'PaperPositionMode\' to \'auto\' from the command line.
set(gcf,\'PaperPositionMode\',\'auto\')
% Setting the current figure\'s (gcf) PaperPositionMode to auto enables
% you to resize the figure window and print it at the size you see on the screen.
举例:
surf(peaks);shading interp % 画图,shading使图像美观
axis off % 不显示坐标轴
set(gcf,\'PaperPositionMode\',\'auto\'); % 设置图像纵横比
print(\'-dpng\',\'-r200\',\'a\'); % 保存图片,名为a
——来自matlab帮助 Printing Images
2.2. Batch Processing(图片保存“批处理”)filename
You can use the function form of print to pass variables containing file names. For example, this for loop uses file names stored in a cell array to create a series of graphs and prints each one with a different file name:
fnames = {\'file1\', \'file2\', \'file3\'};
for k=1:length(fnames)
surf(peaks);shading interp
print(\'-dtiff\',\'-r600\',fnames{k}) % fnames is a cell of string arrays so each element is a string
end
————来自matlab帮助“print”页末
注:如果你不能调整输出分辨率和文件格式,可能是"Printing and Exporting without a Display"问题,具体查看帮助“print”页
———分割线————————————————————————————
1.2. 输出图片的“格式”formats
The following table shows the supported output formats for exporting from figures and the switch settings to use. In some cases, a format is available both as a MATLAB output filter and as a Ghostscript output filter. All formats except for EMF are supported on both Windows and UNIX platforms.
Bitmap or Vector(矢量) |
Print Command Option String |
MATLAB or Ghostscript |
|
BMP monochrome BMP |
Bitmap |
Ghostscript |
|
BMP 24-bit BMP |
Bitmap |
Ghostscript |
|
BMP 8-bit (256-color) BMP (this format uses a fixed colormap) |
Bitmap |
Ghostscript |
|
BMP 24-bit |
Bitmap |
MATLAB |
|
EMF |
Vector |
MATLAB |
|
EPS black and white |
Vector |
MATLAB |
|
EPS color |
Vector |
MATLAB |
|
EPS Level 2 black and white |
Vector |
MATLAB |
|
EPS Level 2 color |
Vector |
MATLAB |
|
HDF 24-bit |
Bitmap |
MATLAB |
|
ILL (Adobe Illustrator) |
Vector |
MATLAB |
|
JPEG 24-bit |
Bitmap |
MATLAB |
|
PBM (plain format) 1-bit |
Bitmap |
Ghostscript |
|
PBM (raw format) 1-bit |
Bitmap |
Ghostscript |
|
PCX 1-bit |
Bitmap |
Ghostscript |
|
PCX 24-bit color PCX file format, three 8-bit planes |
Bitmap |
Ghostscript |
|
PCX 8-bit newer color PCX file format (256-color) |
Bitmap |
Ghostscript |
|
PCX Older color PCX file format (EGA/VGA, 16-color) |
Bitmap |
Ghostscript |
|
PDF Color PDF file format |
Vector |
Ghostscript |
|
PGM Portable Graymap (plain format) |
Bitmap |
Ghostscript |
|
PGM Portable Graymap (raw format) |
Bitmap |
Ghostscript |
|
PNG 24-bit |
Bitmap |
MATLAB |
|
PPM Portable Pixmap (plain format) |
Bitmap |
Ghostscript |
|
PPM Portable Pixmap (raw format) |
Bitmap |
全部评论
-
10-27 六六分期app的软件客服如何联系?(六六分期
-
11-06 亲亲特价:怎么删除回收站图标
-
11-06 济南大学虚拟社区:鲁大师节能降温的具体办
-
11-06 xlueops.exe:无线网络安装向导
-
11-06 女斗合众国:win7系统cf与主机连接不稳定怎
-
11-06 ipz-185:win7系统vcf文件怎么打开
-
11-06 傻哥蹦迪:win10系统s4怎么打开usb调试
-
11-06 八神浩树gtaste:回收站清空了怎么恢复
-
11-06 校园至尊魔王小说:win7系统浏览网页时字体
-
11-06 女斗合众国:win10系统访问共享文件夹提示请
-
11-06 雨酷仙境:设置win7系统转移临时文件夹腾出
-
11-06 阿穆纳伊之杖:win7系统开始菜单在右边还原
-
11-06 甘尔葛分析师:计谋网站seo关键词暴涨有什
-
11-06 蔡贵霖: 计谋网站seo关键词暴涨有什么秘密
-
11-06 博益网首页:ao3网页版进入不了解决方法
-
11-06 漏斗子专栏: 网站数据分析小白易懂精华篇
-
11-06 颾狐蝶蜋:系统资源不足无法完成请求的服务
-
11-06 国光中学校歌:提交网站到alexa查询详细步骤
-
11-06 西安有情天:静态网页和动态网页的区别
-
11-06 红木雅尚斋:外部链接构造对网站的好处
-
11-06 前官礼遇:防止域名劫持–增强域安全性的10
-
11-06 密传二转答案: 中文分词算法有哪些
-
11-06 金泉家园邮编:百度快照劫持的表现及应对方
-
2022-11-06
剪的笔顺,诠释剪的笔画,认识剪的部首
-
六六分期app的软件客服如何联系?(六六分期
2023-10-27
-
florent37/ViewAnimator: A fluent Android
2022-08-15
-
florent37/Shrine-MaterialDesign2: implem
2022-08-17
-
CVE-2020-36276
2022-09-23
-
SimpleSoftwareIO/simple-sms: Send and re
2022-08-13
请发表评论