当前位置:网站首页>Use of print function in MATLAB
Use of print function in MATLAB
2022-07-05 18:04:00 【jk_ one hundred and one】
Catalog
Print a copy of the chart window paper
Copy the window to the clipboard
Save the picture window as an image file
Save the drawing window as a vector graphics file
towards EPS File to add TIFF preview
Specify the drawing window to save
Save the picture window in screen size and resolution
Save the picture window that fills the page
Save the drawing window without saving UIControl
Create high resolution movie frames
print The function is to print the drawing window or save it in a specific file format .
grammar
print(filename,formattype)
print(filename,formattype,formatoptions)
print
print(printer)
print(driver)
print(printer,driver)
print('-clipboard',clipboardformat)
print(resize,___)
print(resolution,___)
print(renderer,___)
print('-noui',___)
print(fig,___)
cdata = print('-RGBImage');
explain
print(filename,formattype) Use the specified file format to save the current drawing window to a file , for example print('BarPlot','-dpng'). If the file does not include an extension , be print The applicable extension will be appended .
print(filename,formattype,formatoptions) Specify additional options available for some formats .print Output the current window to the default printer .
print(printer) Specify the printer . Specify the printer as a character vector or string , It includes -P Printer name at the beginning , for example '-Pmy printer'. The printer must be set up on your system .
print(driver) Specify the driver . If you want to ensure that the printed output is black and white or color , Use this option .
print('-clipboard',clipboardformat) Use clipboardformat Copy the current drawing window to the clipboard in the specified format . You can paste the copied window into other applications .
print(resize,___) Maximize the picture window to fill the page . take resize Designated as '-bestfit' The aspect ratio of the drawing window can be preserved , Designated as '-fillpage' The aspect ratio is ignored . These options can only be saved in page format (PDF and PS) Or send it to the printer for printing . This option can be used with any input parameter in the previous syntax .
print(resolution,___) Use the specified resolution . Specify the resolution as a character vector or string , It includes -r Integer value at the beginning , for example '-r200'. This option can be used with any input parameter in the previous syntax .
print(renderer,___) Use the specified renderer . The renderer can be specified as '-vector' or '-image'.
print('-noui',___) Do not include user interface controls in saved or printed output ( Such as ordinary buttons and sliders ). It does not exclude user interface objects that can contain coordinate areas , for example uitab or uipanel.
print(fig,___) Save or print fig The specified window or window Simulink Module diagram .
cdata = print('-RGBImage'); Return to the current window RGB Image data . The difference between this option and screenshot is that all printing functions can be applied to output . You can also use this syntax to specify resolution、renderer、'-noui' and fig Options . however , Cannot specify Simulink Module diagram .
Example
Print a copy of the chart window paper
Create a bar chart and output it to the system default printer . If you do not specify the drawing window to print , be print Use the current drawing window .
bar(1:10)
print
Copy the window to the clipboard
Create a drawing and copy it to the system clipboard .
plot(1:10)
print('-clipboard','-dmeta')
You can paste the copied drawing into other applications .
Save the picture window as an image file
Create a drawing and save it as PNG image file .
bar(1:10)
print('BarPlot','-dpng')
print Save the drawing as BarPlot.png.
Save the drawing window as a vector graphics file
Create a drawing and save it as encapsulated PostScript file .
bar(1:10)
print('BarPlot','-depsc')
print Save the drawing as BarPlot.eps.
towards EPS File to add TIFF preview
Save the current drawing window as encapsulated PostScript File and add TIFF preview .
surf(peaks)
print('SurfacePlot','-depsc','-tiff')
Specify the drawing window to save
By passing the object variable of a specific drawing window to print To save the drawing window .
fig = figure;
plot(1:10)
print(fig,'MySavedPlot','-dpng')
perhaps , To use its Number The value of the attribute refers to the window , This value is the integer value displayed in the title bar of the drawing window . for example , Save the drawing window and display it in the title bar Figure 2. Add -f.
figure(2);
plot(1:10)
print('-f2','MySavedPlot','-dpng')
Save the picture window in screen size and resolution
Save the surface diagram to PNG In file . Put the picture window PaperPositionMode Property is set to 'auto' To save it as the size displayed on the screen . Use '-r0' It can be saved according to the screen resolution .
surf(peaks)
set(gcf,'PaperPositionMode','auto')
print('PeaksSurface','-dpng','-r0')
Save the picture window that fills the page
Use '-fillpage' Option to save the picture window that fills the page .
bar([1 10 7 8 2 2 9 3 6])
print('FillPageFigure','-dpdf','-fillpage')
Save the drawing window without saving UIControl
Create a diagram window , It contains common buttons for clearing the coordinate area . Save the drawing window to JPEG File without saving ordinary buttons .
surf(peaks)
uicontrol('Style','pushbutton','String','Clear',...
'Position',[20 20 50 20],'Callback','cla');
print('SurfacePlot','-djpeg','-noui')
Return to the RGB Image data
Return to the RGB Image data .
surf(peaks)
cdata = print('-RGBImage');
Use imshow Display image data at full resolution .
imshow(cdata)
Create high resolution movie frames
Create a surface graph . Return to the RGB Image data , And specify the image resolution . then , Convert image data into movie frames F.
surf(peaks)
cdata = print('-RGBImage','-r120');
F = im2frame(cdata);
filename - file name
file name , Specified as a character vector or string , It contains the required file name and path . Maximum length of file name ( Including paths ) Specific to the operating system and file format . Usually , The file name should not exceed 126 Characters , If the path is included , Should not exceed 128 Characters .
formattype - File format
File format , Specify as one of the options in these tables . Bitmap image is a picture window expressed in pixels . The size of the generated file depends on the window 、 Format and system resolution .Web Bitmaps are widely used in browsers and other applications that display graphics . however , They do not support transparency or scaling well , And you can't modify graphic objects in other graphic applications , Such as lines and text .
Options | The bitmap format | Corresponding file extension |
---|---|---|
'-djpeg' | JPEG 24 position | .jpg |
'-dpng' | PNG 24 position | .png |
'-dtiff' | TIFF 24 position ( Compress ) | .tif |
'-dtiffn' | TIFF 24 position ( non-compressed ) | .tif |
'-dmeta' | Enhanced metafile ( Limited to Windows) | .emf |
'-dbmpmono' | BMP monochrome | .bmp |
'-dbmp' | BMP 24 position | .bmp |
'-dbmp16m' | BMP 24 position | .bmp |
'-dbmp256' | BMP 8 position (256 color , Use a fixed color map ) | .bmp |
'-dhdf' | HDF 24 position | .hdf |
'-dpbm' | PBM( Normal format )1 position | .pbm |
'-dpbmraw' | PBM( Original format )1 position | .pbm |
'-dpcxmono' | PCX 1 position | .pcx |
'-dpcx24b' | PCX 24 Bit color ( Three 8 Bit plane ) | .pcx |
'-dpcx256' | PCX 8 Bit new color (256 color ) | .pcx |
'-dpcx16' | PCX Old color (EGA/VGA 16 color ) | .pcx |
'-dpgm' | PGM( Normal format ) | .pgm |
'-dpgmraw' | PGM( Original format ) | .pgm |
'-dppm' | PPM( Normal format ) | .ppm |
'-dppmraw' | PPM( Original format ) | .ppm |
Vector graphics file
The vector graphics file stores commands for redrawing the drawing window . This format type is suitable for scaling , But it may lead to large files . in addition , It may produce objects with wrong three-dimensional arrangement in some cases . Some applications support extensive editing of vector graphics formats . however , Some applications do not support editing other than resizing graphics . Usually , Try to MATLAB Make all necessary changes to the drawing window .
If you set the Renderer attribute , be print Use this renderer when generating output . otherwise ,print Will choose the appropriate renderer . Usually ,print The generated vector graphics file scales well when resizing . For some complex picture windows , The file may contain embedded bitmap images . These bitmap images do not scale well , It may limit the extent to which these images can be edited in other applications . Make sure print Use the vector graphics renderer , Please put '-vector' Designated as print Function's input parameters .
If you want the output to be transparent , Then use metafile 、PDF or SVG Format to create vector graphics file . If you use PS or EPS Format , Only the picture window and coordinate area background support transparency . Bitmap images do not support transparency , But it will be close to the screen display , Present transparent effect .
边栏推荐
猜你喜欢
Neural network self cognition model
Sophon AutoCV:助力AI工业化生产,实现视觉智能感知
最大人工岛[如何让一个连通分量的所有节点都记录总节点数?+给连通分量编号]
Privacy computing helps secure data circulation and sharing
Sophon CE社区版上线,免费Get轻量易用、高效智能的数据分析工具
Leetcode daily question: the first unique character in the string
ISPRS2022/云检测:Cloud detection with boundary nets基于边界网的云检测
IDC report: Tencent cloud database ranks top 2 in the relational database market!
吴恩达团队2022机器学习课程,来啦
图像分类,看我就够啦!
随机推荐
Cmake tutorial Step4 (installation and testing)
Xiaobai getting started with NAS - quick building private cloud tutorial series (I) [easy to understand]
数值计算方法 Chapter8. 常微分方程的数值解
Generate XML schema from class
LeetCode每日一题:合并两个有序数组
MATLAB中print函数使用
leetcode每日一练:旋转数组
访问数据库使用redis作为mysql的缓存(redis和mysql结合)
Which platform of outer disk gold is regular and safe, and how to distinguish it?
EPM相关
苹果手机炒股安全吗?打新债是骗局吗?
matlab内建函数怎么不同颜色,matlab分段函数不同颜色绘图
VC编程入门浅谈「建议收藏」
使用QT遍历Json文档及搜索子对象
Zabbix
Delete some elements in the array
较文心损失一点点性能提升很多
Redis基础
热通孔的有效放置如何改善PCB设计中的热管理?
Ten capabilities that cyber threat analysts should have