Thread Subject: exporting figures from the command line

Subject: exporting figures from the command line

From: o_depot

Date: 10 Jul, 2007 16:39:57

Message: 1 of 4

Hey guys,

   When I'm exporting a figure I usually use the 'File > Export
Setup...' GUI for settings. I have a custom style that I use on all
my figures, which I've saved to 'pub_style1'. I usually apply the
style, then use the 'Export' button to export the picture as a .png
file.

   I was wondering if there was a way to do all this from the MATLAB
command-line...?

Thanks.

Subject: exporting figures from the command line

From: Urs (us) Schwarz

Date: 10 Jul, 2007 20:53:53

Message: 2 of 4

<SNIP <print>ing from the command line...

a hint:

     help print;
% then, look at options
% -dpng
% -r

us

Subject: exporting figures from the command line

From: o_depot

Date: 10 Jul, 2007 18:38:44

Message: 3 of 4

us wrote:
>
>
> <SNIP <print>ing from the command line...
>
> a hint:
>
> help print;
> % then, look at options
> % -dpng
> % -r
>
> us
>
  

thanks us,

   I've used the print command before, -dpng to output as a png, and
-r to set resolution. The 'pub_style1' style that I've saved (and
load through the Export GUI) has many tweaks and changes. Is there
some way to load that style using the print command? Otherwise, is
the only other option to specify each one of these tweaks as flags to
the print command, or modifying the figure from the command line?
It would be nice to run a command which loads up my the 'pub_style1'
style, applies it to the current figure, then exports the figure as a
png (or whatever format)...

Subject: exporting figures from the command line

From: us

Date: 10 Jul, 2007 18:59:19

Message: 4 of 4

o_depot:
<SNIP exporting a fig using a custom style sheet...

one of the (few) solutions

% assume your style sheet's name is <foo.txt>

% create a fig
     plot(1:10);
     fnam='your_fig.png'; % your file name
% the engine
% ...get style sheet info
     snam='foo'; % note: NO extension...
     s=hgexport('readstyle',snam);
% ...apply style sheet info
     hgexport(gcf,fnam,s);

us

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
print us 10 Jul, 2007 16:55:09
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com