(For example, -r300 sets the output resolution to 300 dots per inch.) The -r switch is also supported for Windows Enhanced Metafiles but is not supported for Ghostscript formats. To set the resolution of the output file for a built-in MATLAB format, use the -r switch. To save your figure as a graphics-format file, specify a format switch and filename. You can change this default by editing the printopt.m file. Level 2 PostScript is the default for UNIX. However, not all PostScript printers support Level 2, so determine the capabilities of your printer before using those drivers. Generally, Level 2 PostScript files are smaller and render more quickly when printing than Level 1 PostScript files. HPGL for HP 7475A and other compatible plotters. HP PaintJet X元00 color (not supported on Windows or DEC Alpha) HP Deskjet 550C color (not supported on Windows or DEC Alpha) HP DeskJet 500C/540C color (not supported on Windows or DEC Alpha) HP DeskJet 500C (with 24 bit/pixel color and high-quality Floyd-Steinberg color dithering) (not supported on Windows or DEC Alpha) HP DeskJet 500C (creates black-and-white output) HP DesignJet 650C color (not supported on Windows or DEC Alpha) This is noted in the first column of the table.Ĭanon Color BubbleJet BJC-70/BJC-600/BJC-4000Įpson and compatible 9- or 24-pin dot matrix print driversĮpson and compatible 9-pin with interleaved lines (triple resolution)Įpson LQ-2550 and compatible color (not supported on HP-700)
#MATLAB PRINT DRIVERS#
Some drivers are not available on all platforms. The last column indicates when Ghostscript is used. Some of the drivers are available from a product called Ghostscript, which is shipped with MATLAB. If you do not specify a driver, MATLAB uses the default setting shown in the previous table. The table below shows the complete list of printer drivers supported by MATLAB.
#MATLAB PRINT DRIVER#
dev contains the printer driver or graphics format option for the print command. pcmd contains the command that print uses to send a file to the printer. Pcmd and dev are platform-dependent strings. You can edit the M-file printopt.m to set your default printer type and destination. printopt is an M-file used by print to produce the hardcopy output. Returns strings containing the current system-dependent printing command and output device. This form is useful passing filenames and handles. It enables you to pass variables for any input arguments. (For example, the -noui option suppresses printing of user interface controls.) The Options section lists available options. Specifies print options that modify the action of the print command. The Graphics Format table lists all supported graphics-file formats. A valid format for this operation is either -dmeta (Windows Enhanced Metafile) or -dbitmap (Windows Bitmap).Įxports the figure to the specified file using the specified graphics format, (such as TIFF). The Printer Driver table lists all supported device types.Ĭopies the figure to the system clipboard (Windows only). If you omit -d driver, print uses the default value stored in printopt.m. Prints the figure using the specified printer driver, (such as color PostScript). If filename does not include an extension, print appends an appropriate extension. Sends the contents of the current figure, including bitmap representations of any user interface controls, to the printer using the device and system printing command defined by printopt.ĭirects the output to the file designated by filename. You can use them in any combination or order. All arguments to the print command are optional. Print and printopt produce hardcopy output.
But if you use evalc on a hardcoded string, EG in the example above evalc('disp(whos(''a''))'), then you should be fine.Print, printopt (MATLAB Functions) MATLAB Function Reference
#MATLAB PRINT PC#
Just make sure you only ever use the evalc function if you can trust whatever will be used as the input EG if you allow the input to evalc to be generated from user input, the user could potentially input malicious code, EG that could run a system command which compromises files on your PC etc. > fprintf('%s\n', evalc('disp(whos(''a''))'))Įvalc was introduced into Matlab before R2006a, so you should have no problems with compatibility. See console session below, that fails when trying to print a struct directly using fprintf, and also when trying to use the output of disp, but succeeds when using evalc: > a = įunction is not defined for 'struct' inputs.
Old question, but IMO, the easiest solution is to use the evalc function.