Code covered by the BSD License  

Highlights from
saveSameSize

5.0

5.0 | 5 ratings Rate this file 10 Downloads (last 30 days) File Size: 2.97 KB File ID: #17868

saveSameSize

by Richard Quist

 

03 Dec 2007 (Updated 04 Dec 2007)

Easily print/export figure at on-screen size

| Watch this File

File Information
Description

SAVESAMESIZE print/export figure (h) at same size as on screen.
  SAVESAMESIZE will adjust printing/exporting related properties so the
  figure (h) will print/export the same size as the onscreen display. It
  will print/export the figure and then restore the changed properties to
  the original values

  saveSameSize accepts some optional parameter-value pairs. If used you must
  specify BOTH the parameter name (e.g. 'format') AND the parameter value
  (e.g. 'png'):
      parameter value/meaning
      ---------- --------------------------------------
       'format' output format to generate.
                    Must be one of the formats supported by the print command

                    If not specified, jpeg is used as the default

       'file' path/name of output file to create

                    If not specified, 'figure<N>.<ext>' will be used
                    where <N> is the figure handle and ext
                    <ext> is the extension corresponding to the
                    output format chosen

       'renderer' Renderer to use when creating the output.
                    Must be one renderers supported by MATLAB

                    If not specified, the figure's current renderer will be used

  Example usage:
% save current figure to jpeg file named figure<n>.jpg using the
% figure's current renderer
          saveSameSize(gcf);

% save current figure to png file named test.png using the
% OpenGL renderer
          saveSameSize(gcf, 'format', 'png', 'renderer', 'opengl',...
                    'file', 'test.png');

See also PRINT

  Copyright 2007 The MathWorks, Inc.

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
04 Mar 2008 shan baash

Very useful code to print it to the same size

06 May 2008 jarek tuszynski

Great function. It took me hours to discover that this functionality was not part of MATLAB and that external add-on is needed to perform this basic MATLAB function. Quite shocking.

01 Jul 2008 Nick Steinmetz

Works great - MATLAB was resizing my text boxes and legends, causing them to overlap with the data in the figures. I just slid this function in where I had been using the regular "saveas" and worries all gone. Perfect!

10 Aug 2008 Emery Ku

Many thanks!!

30 Nov 2010 Gary  
Please login to add a comment or rating.
Updates
04 Dec 2007

tweaking description

Tag Activity for this File
Tag Applied By Date/Time
graphics import Richard Quist 22 Oct 2008 09:37:48
graphics export Richard Quist 22 Oct 2008 09:37:48
print Richard Quist 22 Oct 2008 09:37:48
export Richard Quist 22 Oct 2008 09:37:48
output size Richard Quist 22 Oct 2008 09:37:48
figure size Richard Quist 22 Oct 2008 09:37:48
resize Richard Quist 22 Jun 2010 11:39:03
saveas Richard Quist 22 Jun 2010 11:39:03

Contact us at files@mathworks.com