当前位置:网站首页>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 .
边栏推荐
- Nanjing University: Discussion on the training program of digital talents in the new era
- JVM第三话 -- JVM性能调优实战和高频面试题记录
- GFS分布式文件系统
- 华夏基金:基金行业数字化转型实践成果分享
- Cmake tutorial Step4 (installation and testing)
- ISPRS2022/云检测:Cloud detection with boundary nets基于边界网的云检测
- mybash
- To solve the stubborn problem of Lake + warehouse hybrid architecture, xinghuan Technology launched an independent and controllable cloud native Lake warehouse integrated platform
- 图像分类,看我就够啦!
- How awesome is the architecture of "12306"?
猜你喜欢
Why is all (()) true and any (()) false?
ISPRS2020/云检测:Transferring deep learning models for cloud detection between Landsat-8 and Proba-V
使用QT遍历Json文档及搜索子对象
GFS distributed file system
“12306” 的架构到底有多牛逼?
nacos -分布式事务-Seata** linux安装jdk ,mysql5.7启动nacos配置ideal 调用接口配合 (保姆级细节教程)
Redis Foundation
leetcode每日一题:字符串中的第一个唯一字符
ELK日志分析系统
MATLAB查阅
随机推荐
EPM相关
QT console printout
删除数组中的某几个元素
Leetcode daily practice: rotating arrays
[BeanShell] there are many ways to write data locally
mybash
Ten top automation and orchestration tools
Penetrate the whole intranet through socks agent
How to modify MySQL fields as self growing fields
PMP认证需具备哪些条件啊?费用多少啊?
Action avant ou après l'enregistrement du message teamcenter
GIMP 2.10教程「建议收藏」
leetcode每日一练:旋转数组
How to improve the thermal management in PCB design with the effective placement of thermal through holes?
ITK Example
寻找第k小元素 前k小元素 select_k
Find the first k small element select_ k
图扑软件数字孪生 | 基于 BIM 技术的可视化管理系统
Sophon CE社区版上线,免费Get轻量易用、高效智能的数据分析工具
Sophon base 3.1 launched mlops function to provide wings for the operation of enterprise AI capabilities