<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171619</link>
    <title>MATLAB Central Newsreader - publish function - Running matlab using crontab in Linux?</title>
    <description>Feed for thread: publish function - Running matlab using crontab in Linux?</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>Thu, 26 Jun 2008 18:43:06 -0400</pubDate>
      <title>publish function - Running matlab using crontab in Linux?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171619#439727</link>
      <author>Kristen Lessel</author>
      <description>Hello,&lt;br&gt;
&lt;br&gt;
I am using linux and have been attempting to set matlab up&lt;br&gt;
to automatically execute my code every few hours using&lt;br&gt;
crontab on Linux.  I am currently using the 'publish'&lt;br&gt;
function to capture the graph that is outputted in html&lt;br&gt;
form.  However, when using crontab, since there is no&lt;br&gt;
display selected, matlab gives a warning on startup in the&lt;br&gt;
command prompt:&lt;br&gt;
&lt;br&gt;
Warning: No display specified.  You will not be able to&lt;br&gt;
display graphics on the screen.&lt;br&gt;
Warning: No window system found.  Java option 'MWT' ignored&lt;br&gt;
&lt;br&gt;
And subsequently errors:&lt;br&gt;
&lt;br&gt;
Error using ==&amp;gt; print at 310&lt;br&gt;
Error using ==&amp;gt; prepareui at 56&lt;br&gt;
Printing of uicontrols is not supported on this platform.&lt;br&gt;
Error in ==&amp;gt; print at 310&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw(ex);&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; snapnow&amp;gt;snapFigure at 349&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print(f,printOptions{:},imgFileName);&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; snapnow&amp;gt;leavingCell at 106&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;snapFigure( ...&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; snapnow at 61&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;data = leavingCell(iCell,data);&lt;br&gt;
&lt;br&gt;
Does anyone know any way around this?  I've tried messing&lt;br&gt;
with a few of the different publish options.. but so far&lt;br&gt;
none of them have worked.  Does anyone know a way around&lt;br&gt;
this?  Or if there is another way to automate capturing&lt;br&gt;
figure output?  Please help!  Thank you!!</description>
    </item>
    <item>
      <pubDate>Thu, 26 Jun 2008 19:14:02 -0400</pubDate>
      <title>Re: publish function - Running matlab using crontab in Linux?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171619#439742</link>
      <author>Scott Burnside</author>
      <description>&quot;Kristen Lessel&quot; &amp;lt;drangelpsyche@yahoo.com&amp;gt; wrote in &lt;br&gt;
message &amp;lt;g40nvq$96h$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hello,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am using linux and have been attempting to set matlab &lt;br&gt;
up&lt;br&gt;
&amp;gt; to automatically execute my code every few hours using&lt;br&gt;
&amp;gt; crontab on Linux.  I am currently using the 'publish'&lt;br&gt;
&amp;gt; function to capture the graph that is outputted in html&lt;br&gt;
&amp;gt; form.  However, when using crontab, since there is no&lt;br&gt;
&amp;gt; display selected, matlab gives a warning on startup in &lt;br&gt;
the&lt;br&gt;
&amp;gt; command prompt:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Warning: No display specified.  You will not be able to&lt;br&gt;
&amp;gt; display graphics on the screen.&lt;br&gt;
&amp;gt; Warning: No window system found.  Java option 'MWT' &lt;br&gt;
ignored&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; And subsequently errors:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Error using ==&amp;gt; print at 310&lt;br&gt;
&amp;gt; Error using ==&amp;gt; prepareui at 56&lt;br&gt;
&amp;gt; Printing of uicontrols is not supported on this platform.&lt;br&gt;
&amp;gt; Error in ==&amp;gt; print at 310&lt;br&gt;
&amp;gt;     throw(ex);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Error in ==&amp;gt; snapnow&amp;gt;snapFigure at 349&lt;br&gt;
&amp;gt;         print(f,printOptions{:},imgFileName);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Error in ==&amp;gt; snapnow&amp;gt;leavingCell at 106&lt;br&gt;
&amp;gt;     snapFigure( ...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Error in ==&amp;gt; snapnow at 61&lt;br&gt;
&amp;gt;     data = leavingCell(iCell,data);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Does anyone know any way around this?  I've tried messing&lt;br&gt;
&amp;gt; with a few of the different publish options.. but so far&lt;br&gt;
&amp;gt; none of them have worked.  Does anyone know a way around&lt;br&gt;
&amp;gt; this?  Or if there is another way to automate capturing&lt;br&gt;
&amp;gt; figure output?  Please help!  Thank you!!&lt;br&gt;
&amp;gt; &lt;br&gt;
Kristen,&lt;br&gt;
&lt;br&gt;
You could take a look at getframe (a built-in wrapper for &lt;br&gt;
capturescreen.dll). You could save the frames off to a &lt;br&gt;
file etc.&lt;br&gt;
&lt;br&gt;
hth,&lt;br&gt;
Scott</description>
    </item>
    <item>
      <pubDate>Thu, 26 Jun 2008 20:10:22 -0400</pubDate>
      <title>Re: publish function - Running matlab using crontab in Linux?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171619#439752</link>
      <author>Kristen Lessel</author>
      <description>&lt;br&gt;
&amp;gt; Kristen,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; You could take a look at getframe (a built-in wrapper for &lt;br&gt;
&amp;gt; capturescreen.dll). You could save the frames off to a &lt;br&gt;
&amp;gt; file etc.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; hth,&lt;br&gt;
&amp;gt; Scott&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Hi Scott,&lt;br&gt;
&lt;br&gt;
I did actually try that, but to  no avail.  I set&lt;br&gt;
&lt;br&gt;
options.figureSnapMethod = 'getframe'&lt;br&gt;
&lt;br&gt;
the error message that I then get is different.. but still&lt;br&gt;
an error message nonetheless:&lt;br&gt;
&lt;br&gt;
Error using ==&amp;gt; imwrite at 370&lt;br&gt;
Image data can not be empty.&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; imwrite at 370&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;error('MATLAB:imwrite:emptyImage', 'Image data can not&lt;br&gt;
be empty.');&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; snapnow&amp;gt;writeImage at 443&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;imwrite(x,imgFileName,imageType);&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; snapnow&amp;gt;snapFigure at 296&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
writeImage(imgFileName,imageType,myFrame,imHeight,imWidth);&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; snapnow&amp;gt;leavingCell at 106&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;snapFigure( ...&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; snapnow at 61&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;data = leavingCell(iCell,data);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Am I doing this wrong?  Or is there perhaps another way? &lt;br&gt;
Thanks again!</description>
    </item>
    <item>
      <pubDate>Thu, 26 Jun 2008 20:17:03 -0400</pubDate>
      <title>Re: publish function - Running matlab using crontab in Linux?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171619#439753</link>
      <author>Matthew Simoneau</author>
      <description>To render user interface stuff like buttons, MATLAB needs a&lt;br&gt;
display.  PRINT uses something like GETFRAME to capture&lt;br&gt;
these, that is, it needs a screen to snap.  Maybe it's&lt;br&gt;
possible to set up some sort of hidden display on Linux, but&lt;br&gt;
that's my only idea.</description>
    </item>
    <item>
      <pubDate>Thu, 26 Jun 2008 20:23:02 -0400</pubDate>
      <title>Re: publish function - Running matlab using crontab in Linux?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171619#439756</link>
      <author>Scott Burnside</author>
      <description>&quot;Kristen Lessel&quot; &amp;lt;drangelpsyche@yahoo.com&amp;gt; wrote in &lt;br&gt;
message &amp;lt;g40t3e$bmr$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Kristen,&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; You could take a look at getframe (a built-in wrapper &lt;br&gt;
for &lt;br&gt;
&amp;gt; &amp;gt; capturescreen.dll). You could save the frames off to a &lt;br&gt;
&amp;gt; &amp;gt; file etc.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; hth,&lt;br&gt;
&amp;gt; &amp;gt; Scott&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hi Scott,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I did actually try that, but to  no avail.  I set&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; options.figureSnapMethod = 'getframe'&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; the error message that I then get is different.. but &lt;br&gt;
still&lt;br&gt;
&amp;gt; an error message nonetheless:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Error using ==&amp;gt; imwrite at 370&lt;br&gt;
&amp;gt; Image data can not be empty.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Error in ==&amp;gt; imwrite at 370&lt;br&gt;
&amp;gt;     error('MATLAB:imwrite:emptyImage', 'Image data can &lt;br&gt;
not&lt;br&gt;
&amp;gt; be empty.');&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Error in ==&amp;gt; snapnow&amp;gt;writeImage at 443&lt;br&gt;
&amp;gt;     imwrite(x,imgFileName,imageType);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Error in ==&amp;gt; snapnow&amp;gt;snapFigure at 296&lt;br&gt;
&amp;gt;        &lt;br&gt;
&amp;gt; writeImage&lt;br&gt;
(imgFileName,imageType,myFrame,imHeight,imWidth);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Error in ==&amp;gt; snapnow&amp;gt;leavingCell at 106&lt;br&gt;
&amp;gt;     snapFigure( ...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Error in ==&amp;gt; snapnow at 61&lt;br&gt;
&amp;gt;     data = leavingCell(iCell,data);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Am I doing this wrong?  Or is there perhaps another way? &lt;br&gt;
&amp;gt; Thanks again!&lt;br&gt;
&lt;br&gt;
You might need to use getframe(gcf). Getframe produces a &lt;br&gt;
structured output. Take a look at the documentation to see &lt;br&gt;
if its going to work for your purpose.&lt;br&gt;
&lt;br&gt;
Scott</description>
    </item>
    <item>
      <pubDate>Thu, 26 Jun 2008 20:31:02 -0400</pubDate>
      <title>Re: publish function - Running matlab using crontab in Linux?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171619#439757</link>
      <author>Kristen Lessel</author>
      <description>&quot;Matthew Simoneau&quot; &amp;lt;matthew@mathworks.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;g40tfv$g04$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; To render user interface stuff like buttons, MATLAB needs a&lt;br&gt;
&amp;gt; display.  PRINT uses something like GETFRAME to capture&lt;br&gt;
&amp;gt; these, that is, it needs a screen to snap.  Maybe it's&lt;br&gt;
&amp;gt; possible to set up some sort of hidden display on Linux, but&lt;br&gt;
&amp;gt; that's my only idea.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Is there any other way to automatically save a figure in matlab?</description>
    </item>
    <item>
      <pubDate>Thu, 26 Jun 2008 20:48:02 -0400</pubDate>
      <title>Re: publish function - Running matlab using crontab in Linux?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171619#439760</link>
      <author>Scott Burnside</author>
      <description>&quot;Kristen Lessel&quot; &amp;lt;drangelpsyche@yahoo.com&amp;gt; wrote in &lt;br&gt;
message &amp;lt;g40ua6$pnk$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Matthew Simoneau&quot; &amp;lt;matthew@mathworks.com&amp;gt; wrote in &lt;br&gt;
message&lt;br&gt;
&amp;gt; &amp;lt;g40tfv$g04$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; To render user interface stuff like buttons, MATLAB &lt;br&gt;
needs a&lt;br&gt;
&amp;gt; &amp;gt; display.  PRINT uses something like GETFRAME to capture&lt;br&gt;
&amp;gt; &amp;gt; these, that is, it needs a screen to snap.  Maybe it's&lt;br&gt;
&amp;gt; &amp;gt; possible to set up some sort of hidden display on &lt;br&gt;
Linux, but&lt;br&gt;
&amp;gt; &amp;gt; that's my only idea.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Is there any other way to automatically save a figure in &lt;br&gt;
matlab?&lt;br&gt;
&lt;br&gt;
Kristen, you can save the figures directly. Take a look at &lt;br&gt;
hgsave and hgload.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Scott</description>
    </item>
    <item>
      <pubDate>Thu, 26 Jun 2008 22:46:02 -0400</pubDate>
      <title>Re: publish function - Running matlab using crontab in Linux?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171619#439786</link>
      <author>Kristen Lessel</author>
      <description>&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Kristen, you can save the figures directly. Take a look at &lt;br&gt;
&amp;gt; hgsave and hgload.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Scott&lt;br&gt;
&lt;br&gt;
Unfortunately that only saves .fig files... i need to be&lt;br&gt;
able to put these on the web... and in any case.. crontab&lt;br&gt;
will still have issues with this as again.. it needs a&lt;br&gt;
display..  Thanks for your help though</description>
    </item>
    <item>
      <pubDate>Thu, 26 Jun 2008 23:28:01 -0400</pubDate>
      <title>Re: publish function - Running matlab using crontab in Linux?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171619#439791</link>
      <author>Scott Burnside</author>
      <description>&quot;Kristen Lessel&quot; &amp;lt;drangelpsyche@yahoo.com&amp;gt; wrote in &lt;br&gt;
message &amp;lt;g41679$rth$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Kristen, you can save the figures directly. Take a &lt;br&gt;
look at &lt;br&gt;
&amp;gt; &amp;gt; hgsave and hgload.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Scott&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Unfortunately that only saves .fig files... i need to be&lt;br&gt;
&amp;gt; able to put these on the web... and in any case.. crontab&lt;br&gt;
&amp;gt; will still have issues with this as again.. it needs a&lt;br&gt;
&amp;gt; display..  Thanks for your help though&lt;br&gt;
&lt;br&gt;
Sorry I was not helpful. Don't give up, though. Somebody &lt;br&gt;
smarter will come along and respond to this thread.&lt;br&gt;
&lt;br&gt;
Scott</description>
    </item>
    <item>
      <pubDate>Wed, 12 Aug 2009 00:20:18 -0400</pubDate>
      <title>Re: publish function - Running matlab using crontab in Linux?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/171619#672355</link>
      <author>John Dunlap</author>
      <description>&quot;Scott Burnside&quot; &amp;lt;no@spam.com&amp;gt; wrote in message &amp;lt;g418m1$83c$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Kristen Lessel&quot; &amp;lt;drangelpsyche@yahoo.com&amp;gt; wrote in &lt;br&gt;
&amp;gt; message &amp;lt;g41679$rth$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Kristen, you can save the figures directly. Take a &lt;br&gt;
&amp;gt; look at &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; hgsave and hgload.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Scott&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Unfortunately that only saves .fig files... i need to be&lt;br&gt;
&amp;gt; &amp;gt; able to put these on the web... and in any case.. crontab&lt;br&gt;
&amp;gt; &amp;gt; will still have issues with this as again.. it needs a&lt;br&gt;
&amp;gt; &amp;gt; display..  Thanks for your help though&lt;br&gt;
&amp;gt; &lt;br&gt;
see: &lt;a href=&quot;http://en.wikipedia.org/wiki/Xvfb&quot;&gt;http://en.wikipedia.org/wiki/Xvfb&lt;/a&gt;&amp;gt; Sorry I was not helpful. Don't give up, though. Somebody &lt;br&gt;
&amp;gt; smarter will come along and respond to this thread.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Scott&lt;br&gt;
&lt;br&gt;
To make automatic web pages I run Matlab in VNC.  My scripts loop using pause(60) until &quot;now&quot; returns the desired time or until an input file is updated (I use the date element returned from &quot;dir&quot;).&lt;br&gt;
&lt;br&gt;
In cron try making a dummy DISPLAY using xvfb, a virtual frame buffer for X windows.&lt;br&gt;
see: &lt;a href=&quot;http://en.wikipedia.org/wiki/Xvfb&quot;&gt;http://en.wikipedia.org/wiki/Xvfb&lt;/a&gt;&lt;br&gt;
You can try starting with &quot;matlab -nosplash -nojvm&quot;. &lt;br&gt;
&lt;br&gt;
Regards,&lt;br&gt;
John</description>
    </item>
  </channel>
</rss>

