当前位置:网站首页>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)
printCopy 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 .
边栏推荐
- GIMP 2.10教程「建议收藏」
- leetcode每日一题:字符串中的第一个唯一字符
- ISPRS2020/云检测:Transferring deep learning models for cloud detection between Landsat-8 and Proba-V
- Generate classes from XML schema
- 星环科技重磅推出数据要素流通平台Transwarp Navier,助力企业实现隐私保护下的数据安全流通与协作
- 开户复杂吗?网上开户安全么?
- ITK Example
- Image classification, just look at me!
- Leetcode notes: Weekly contest 300
- Zabbix
猜你喜欢

PMP认证需具备哪些条件啊?费用多少啊?

flask接口响应中的中文乱码(unicode)处理

隐私计算助力数据的安全流通与共享

Configure pytorch environment in Anaconda - win10 system (small white packet meeting)

Redis Foundation

IDC report: Tencent cloud database ranks top 2 in the relational database market!

Redis基础

「运维有小邓」用于云应用程序的单点登录解决方案

Career advancement Guide: recommended books for people in big factories

ISPRS2022/雲檢測:Cloud detection with boundary nets基於邊界網的雲檢測
随机推荐
Is it safe to open an account online? What is the general interest rate of securities financing?
Leetcode exercise - 206 Reverse linked list
星环科技重磅推出数据要素流通平台Transwarp Navier,助力企业实现隐私保护下的数据安全流通与协作
Data access - entityframework integration
Sophon base 3.1 launched mlops function to provide wings for the operation of enterprise AI capabilities
Gimp 2.10 tutorial "suggestions collection"
JVM third talk -- JVM performance tuning practice and high-frequency interview question record
Find the first k small element select_ k
每日一练:关于日期的一系列
苹果手机炒股安全吗?打新债是骗局吗?
图像分类,看我就够啦!
[paddleclas] common commands
Easynmon Usage Summary
GFS distributed file system
图片数据不够?我做了一个免费的图像增强软件
开户复杂吗?网上开户安全么?
MATLAB中print函数使用
Use QT designer interface class to create two interfaces, and switch from interface 1 to interface 2 by pressing the key
"Xiaodeng in operation and maintenance" is a single sign on solution for cloud applications
QT console printout