This is a static copy of a profile report

Home

print (6 calls, 22.547 sec)
Generated 14-Nov-2016 07:47:16 using cpu time.
function in file /usr/local/MATLAB/MATLAB_Production_Server/R2015a/toolbox/matlab/graphics/print.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
saveasfunction6
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
215
pj = alternatePrintPath(pj);
622.467 s99.6%
156
[pj, devices, options ] = inpu...
60.040 s0.2%
200
pj = name( pj );
60.030 s0.1%
153
[pj, inputargs] = LocalCreateP...
60.010 s0.0%
220
return;
60 s0%
All other lines  0.000 s0.0%
Totals  22.547 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
graphics/private/alternatePrintPathfunction622.467 s99.6%
graphics/private/inputcheckfunction60.040 s0.2%
graphics/private/namefunction60.030 s0.1%
print>LocalCreatePrintJobsubfunction60.010 s0.0%
graphics/private/setupfunction60 s0%
graphics/private/validatefunction60 s0%
print>LocalHandleSimulinksubfunction60 s0%
Self time (built-ins, overhead, etc.)  0.000 s0.0%
Totals  22.547 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function225
Non-code lines (comments, blank lines)178
Code lines (lines that can run)47
Code lines that did run14
Code lines that did not run33
Coverage (did run/can run)29.79 %
Function listing
time 
calls 
 line
   1 
function varargout = print( varargin )
   2 
    %PRINT Print figure or model. Save to disk as image or MATLAB file.
   3 
    %   SYNTAX:
   4 
    %     print
   5 
    %       PRINT alone sends the current figure to your current printer.
   6 
    %       The size and position of the printed output depends on the figure's
   7 
    %       PaperPosition[mode] properties and your default print command
   8 
    %       as specified in your PRINTOPT.M file.
   9 
    %
  10 
    %     print -s
  11 
    %       Same as above but prints the current Simulink model.
  12 
    %
  13 
    %     print -device -options
  14 
    %       You can optionally specify a print device (i.e., an output format such
  15 
    %       as tiff or PostScript or a print driver that controls what is sent to
  16 
    %       your printer) and options that control various characteristics  of the
  17 
    %       printed file (i.e., the resolution, the figure to print
  18 
    %       etc.). Available devices and options are described below.
  19 
    %
  20 
    %     print -device -options filename
  21 
    %       If you specify a filename, MATLAB directs output to a file instead of
  22 
    %       a printer. PRINT adds the appropriate file extension if you do not
  23 
    %       specify one.
  24 
    %
  25 
    %     print( ... )
  26 
    %       Same as above but this calls PRINT as a MATLAB function instead of
  27 
    %       a MATLAB command. The difference is only in the parenthesized argument
  28 
    %       list. It allows the passing of variables for any of the input
  29 
    %       arguments and is especially useful for passing the handles
  30 
    %       of figures and/or models to print and filenames.
  31 
    %
  32 
    %     Note: PRINT will produce a warning when printing a figure with a
  33 
    %     ResizeFcn.  To avoid the warning, set the PaperPositionMode to 'auto'
  34 
    %     or match figure screen size in the PageSetup dialog.
  35 
    %
  36 
    %   BATCH PROCESSING:
  37 
    %       You can use the function form of PRINT, which is useful for batch
  38 
    %       printing. For example, you can use a for loop to create different
  39 
    %       graphs and print a series of files whose names are stored in an array:
  40 
    %
  41 
    %       for i=1:length(fnames)
  42 
    %           print('-dpsc','-r200',fnames(i))
  43 
    %       end
  44 
    %
  45 
    %   SPECIFYING THE WINDOW TO PRINT
  46 
    %       -f<handle>   % Handle Graphics handle of figure to print
  47 
    %       -s<name>     % Name of an open Simulink model to print
  48 
    %       h            % Figure or model handle when using function form of PRINT
  49 
    %
  50 
    %     Examples:
  51 
    %       print -f2    % Both commands print Figure 2 using the default driver
  52 
    %       print( 2 )   % and operating system command specified in PRINTOPT.
  53 
    %
  54 
    %       print -svdp  % prints the open Simulink model named vdp
  55 
    %
  56 
    %   SPECIFYING THE OUTPUT FILE:
  57 
    %       <filename>   % String on the command line
  58 
    %       '<filename>' % String passed in when using function form of PRINT
  59 
    %
  60 
    %     Examples:
  61 
    %       print -dps foo
  62 
    %       fn = 'foo'; print( gcf, '-dps', fn )
  63 
    %       Both save the current figure to a file named 'foo.ps' in the current
  64 
    %       working directory. This file can now be printed to a
  65 
    %       PostScript-compatible printer.
  66 
    %
  67 
    %   COMMON DEVICE DRIVERS
  68 
    %       Output format is specified by the device driver input argument. This
  69 
    %       argument always starts with '-d' and falls into one of several
  70 
    %       categories:
  71 
    %     Microsoft Windows system device driver options:
  72 
    %       -dwin      % Send figure to current printer in monochrome
  73 
    %       -dwinc     % Send figure to current printer in color
  74 
    %       -dmeta     % Send figure to clipboard (or file) in Metafile format
  75 
    %       -dbitmap   % Send figure to clipboard (or file) in bitmap format
  76 
    %       -v         % Verbose mode, bring up the Print dialog box
  77 
    %                    which is normally suppressed.
  78 
    %
  79 
    %     Built-in MATLAB Drivers:
  80 
    %       -dps       % PostScript for black and white printers
  81 
    %       -dpsc      % PostScript for color printers
  82 
    %       -dps2      % Level 2 PostScript for black and white printers
  83 
    %       -dpsc2     % Level 2 PostScript for color printers
  84 
    %
  85 
    %       -deps      % Encapsulated PostScript
  86 
    %       -depsc     % Encapsulated Color PostScript
  87 
    %       -deps2     % Encapsulated Level 2 PostScript
  88 
    %       -depsc2    % Encapsulated Level 2 Color PostScript
  89 
    %
  90 
    %       -dpdf      % Color PDF file format
  91 
    %       -dsvg      % Scalable Vector Graphics
  92 
    %
  93 
    %       -djpeg<nn> % JPEG image, quality level of nn (figures only)
  94 
    %                    E.g., -djpeg90 gives a quality level of 90.
  95 
    %                    Quality level defaults to 75 if nn is omitted.
  96 
    %       -dtiff     % TIFF with packbits (lossless run-length encoding)
  97 
    %                    compression (figures only)
  98 
    %       -dtiffnocompression % TIFF without compression (figures only)
  99 
    %       -dpng      % Portable Network Graphic 24-bit truecolor image
 100 
    %                    (figures only)
 101 
    %       -dbmpmono  % Monochrome .BMP file format
 102 
    %       -dbmp256   % 8-bit (256-color) .BMP file format
 103 
    %       -dbmp16m   % 24-bit .BMP file format
 104 
    %       -dpcxmono  % Monochrome PCX file format
 105 
    %       -dpcx16    % Older color PCX file format (EGA/VGA, 16-color)
 106 
    %       -dpcx256   % Newer color PCX file format (256-color)
 107 
    %       -dpcx24b   % 24-bit color PCX file format, 3 8-bit planes
 108 
    %       -dpbm      % Portable Bitmap (plain format)
 109 
    %       -dpbmraw   % Portable Bitmap (raw format)
 110 
    %       -dpgm      % Portable Graymap (plain format)
 111 
    %       -dpgmraw   % Portable Graymap (raw format)
 112 
    %       -dppm      % Portable Pixmap (plain format)
 113 
    %       -dppmraw   % Portable Pixmap (raw format)
 114 
    %
 115 
    %     Examples:
 116 
    %       print -dwinc  % Prints current Figure to current printer in color
 117 
    %       print( h, '-djpeg', 'foo') % Prints Figure/model h to foo.jpg
 118 
    %
 119 
    %   PRINTING OPTIONS
 120 
    %     Options only for use with PostScript and GhostScript drivers:
 121 
    %       -loose     % Use Figure's PaperPosition as PostScript BoundingBox
 122 
    %       -append    % Append, not overwrite, the graph to PostScript file
 123 
    %       -tiff      % Add TIFF preview, EPS files only (implies -loose)
 124 
    %       -cmyk      % Use CMYK colors instead of RGB
 125 
    %
 126 
    %     Options for PostScript, GhostScript, Tiff, Jpeg, and Metafile:
 127 
    %       -r<number> % Dots-per-inch resolution. Defaults to 90 for Simulink,
 128 
    %                    150 for figures in image formats and when
 129 
    %                    printing in Z-buffer or OpenGL mode,  screen
 130 
    %                    resolution for Metafiles and 864 otherwise.
 131 
    %                    Use -r0 to specify screen resolution.
 132 
    %     Example:
 133 
    %       print -depsc -tiff -r300 matilda
 134 
    %       Saves current figure at 300 dpi in color EPS to matilda.eps
 135 
    %       with a TIFF preview (at 72 dpi for Simulink models and 150 dpi
 136 
    %       for figures). This TIFF preview will show up on screen if
 137 
    %       matilda.eps is inserted as a Picture in a Word document, but
 138 
    %       the EPS will be used if the Word document is printed on a
 139 
    %       PostScript printer.
 140 
    %
 141 
    %     Other options for figure windows:
 142 
    %       -Pprinter  % Specify the printer. On Windows and Unix.
 143 
    %       -noui      % Do not print UI control objects
 144 
    %       -painters  % Rendering for printing to be done in Painters mode
 145 
    %       -opengl    % Rendering for printing to be done in OpenGL mode
 146 
    %
 147 
    %   See the Using MATLAB Graphics manual for more information on printing.
 148 
    %
 149 
    %   See also PRINTOPT, PRINTDLG, ORIENT, IMWRITE, HGSAVE, SAVEAS.
 150 
    
 151 
    %   Copyright 1984-2014 The MathWorks, Inc.
 152 
    
  0.01 
      6 
 153 
    [pj, inputargs] = LocalCreatePrintJob(varargin{:}); 
 154 
    
 155 
    %Check the input arguments and flesh out settings of PrintJob
  0.04 
      6 
 156 
    [pj, devices, options ] = inputcheck( pj, inputargs{:} ); 
 157 
    
      6 
 158 
    try 
      6 
 159 
        if LocalHandleSimulink(pj) 
 160 
            return
 161 
        end
 162 
    catch me
 163 
        % We want to see the complete stack in debug mode...
 164 
        if(pj.DebugMode)
 165 
            rethrow(me);
 166 
        else % ...and a simple one in non-debug
 167 
            throwAsCaller(me); 
 168 
        end
 169 
    end
 170 
    
 171 
    %User can find out what devices and options are supported by
 172 
    %asking for output and giving just the input argument '-d'.
 173 
    %Do it here rather then inputcheck so stack trace makes more sense.
      6 
 174 
    if strcmp( pj.Driver, '-d' ) 
 175 
        if nargout == 0
 176 
            disp(getString(message('MATLAB:uistring:print:SupportedDevices')))
 177 
            for i=1:length(devices)
 178 
                disp(['    -d' devices{i}])
 179 
            end
 180 
        else
 181 
            varargout{1} = devices;
 182 
            varargout{2} = options;
 183 
        end
 184 
        %Don't actually print anything if user is inquiring.
 185 
        return
 186 
    end
 187 
    
 188 
    %Be sure to restore pointers on exit.
      6 
 189 
    if pj.UseOriginalHGPrinting 
 190 
        pj = preparepointers( pj );
 191 
        cleanupHandler = onCleanup(@() restorepointers(pj));
 192 
    end
 193 
    
 194 
    %Validate that PrintJob state is ok, that input arguments
 195 
    %and defaults work together.
      6 
 196 
    pj = validate( pj ); 
 197 
    
 198 
    %Handle missing or illegal filename.
 199 
    %Save possible name first for potential use in later warning.
  0.03 
      6 
 200 
    pj = name( pj ); 
 201 
    
 202 
    %If only want to setup the output, do it and early exit.
 203 
    %Currently this is a PC only thing, opens standard Windows Print dialog.
      6 
 204 
    if setup( pj ) 
 205 
        return
 206 
    end
 207 
    
 208 
    %Sometimes need help tracking down problems...
      6 
 209 
    if pj.DebugMode 
 210 
        disp(getString(message('MATLAB:uistring:print:PrintJobObject')))
 211 
        disp(pj)
 212 
    end
 213 
    
 214 
    %If handled via new path just return from here, otherwise fall through
 22.47 
      6 
 215 
    pj = alternatePrintPath(pj); 
      6 
 216 
    if pj.donePrinting 
      6 
 217 
        if pj.RGBImage 
 218 
            varargout(1) = {pj.Return};
 219 
        end
      6 
 220 
        return; 
 221 
    end
 222 
    
 223 
    LocalPrint(pj);
 224 
    
 225 
end

Other subfunctions in this file are not included in this listing.