<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264896</link>
    <title>MATLAB Central Newsreader - help to save file from histogram</title>
    <description>Feed for thread: help to save file from histogram</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Wed, 04 Nov 2009 04:06:02 -0500</pubDate>
      <title>help to save file from histogram</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264896#691902</link>
      <author>uny gg</author>
      <description>Hello all&lt;br&gt;
&lt;br&gt;
I am trying to save the histogram image as a file.. (any format e.g. png, jpeg. etc)&lt;br&gt;
The problem is that I have to do this continuous many times.. &lt;br&gt;
&lt;br&gt;
Here is may code.&lt;br&gt;
&lt;br&gt;
function dim = PatchDistHistogram(data)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dim = size(data);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;nFeature = dim(2);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for i=1:nFeature&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hist(data(:,i));&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fname = ['astro' int2str(i) '.png'];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fname&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print fname -dpng &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
When I run this code, it shows that each histogram in screen, however,&lt;br&gt;
There is no file which is created from this.&lt;br&gt;
&lt;br&gt;
I am not sure.. what is problem.&lt;br&gt;
&lt;br&gt;
Could you please somebody help me with this? </description>
    </item>
    <item>
      <pubDate>Wed, 04 Nov 2009 04:46:00 -0500</pubDate>
      <title>Re: help to save file from histogram</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264896#691908</link>
      <author>the cyclist</author>
      <description>&quot;uny gg&quot; &amp;lt;illinois.ks@gmail.com&amp;gt; wrote in message &amp;lt;hcquja$ht8$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hello all&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am trying to save the histogram image as a file.. (any format e.g. png, jpeg. etc)&lt;br&gt;
&amp;gt; The problem is that I have to do this continuous many times.. &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Here is may code.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function dim = PatchDistHistogram(data)&lt;br&gt;
&amp;gt;     dim = size(data);&lt;br&gt;
&amp;gt;     nFeature = dim(2);&lt;br&gt;
&amp;gt;    &lt;br&gt;
&amp;gt;     for i=1:nFeature&lt;br&gt;
&amp;gt;       hist(data(:,i));&lt;br&gt;
&amp;gt;       fname = ['astro' int2str(i) '.png'];&lt;br&gt;
&amp;gt;       fname&lt;br&gt;
&amp;gt;       print fname -dpng &lt;br&gt;
&amp;gt;     end&lt;br&gt;
&amp;gt;     &lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; When I run this code, it shows that each histogram in screen, however,&lt;br&gt;
&amp;gt; There is no file which is created from this.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am not sure.. what is problem.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Could you please somebody help me with this? &lt;br&gt;
&lt;br&gt;
Use the functional form of print when you have a string with the filename.  I think the syntax, the way you have created &quot;fname&quot;, should be&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; print('-dpng',fname)&lt;br&gt;
&lt;br&gt;
If that does not work, look at &quot;help print&quot; for the functional method syntax.</description>
    </item>
    <item>
      <pubDate>Wed, 04 Nov 2009 05:01:35 -0500</pubDate>
      <title>Re: help to save file from histogram</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264896#691911</link>
      <author>uny gg</author>
      <description>Hello cyclist&lt;br&gt;
&lt;br&gt;
Thank you for your response.&lt;br&gt;
I also tried with that.. It doesn't work for me.&lt;br&gt;
I looked at the &quot;print&quot; help manual. However, I could not figure out the way .. T.T&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Any ideas?</description>
    </item>
    <item>
      <pubDate>Wed, 04 Nov 2009 11:41:32 -0500</pubDate>
      <title>Re: help to save file from histogram</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264896#692003</link>
      <author>ImageAnalyst</author>
      <description>I use Oliver Woodford's &quot;export_fig&quot; -- it's in the FileExchange.&lt;br&gt;
People always have trouble trying to figure out saving figures&lt;br&gt;
properly using the built in MATLAB routines.  export_fig() does what&lt;br&gt;
you want and expect and it's easy to use.  It uses the built in&lt;br&gt;
routines too but it knows how to set and use them properly, relieving&lt;br&gt;
you of that pain.</description>
    </item>
  </channel>
</rss>

