<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246457</link>
    <title>MATLAB Central Newsreader - Diary quirkyness</title>
    <description>Feed for thread: Diary quirkyness</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, 11 Mar 2009 23:59:02 -0400</pubDate>
      <title>Diary quirkyness</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246457#634193</link>
      <author>Todd Welti</author>
      <description>I have some code that uses &quot;diary&quot; near the start to make a log file.  I had checked it early on and it seemed to work fine.  now though i notice that sometimes the file is empty, if the code encounters errors and quits.  Does diary wait until its associated mfile is finished to write to the diary file?  I tested this by putting in a breakpoint after the diary file was created and some text was displayed in the console, but before the main mfile had finished.  i saw the diary .txt file, but nothing in it.  perhaps it slows down execution if each text line in the console is written to the diary file realitme.  Perhaps there is a buffer...?</description>
    </item>
    <item>
      <pubDate>Thu, 12 Mar 2009 14:11:56 -0400</pubDate>
      <title>Re: Diary quirkyness</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246457#634339</link>
      <author>Steven Lord</author>
      <description>&lt;br&gt;
&quot;Todd Welti&quot; &amp;lt;twelti@harman.com&amp;gt; wrote in message &lt;br&gt;
news:gp9j86$i4r$1@fred.mathworks.com...&lt;br&gt;
&amp;gt;I have some code that uses &quot;diary&quot; near the start to make a log file.  I &lt;br&gt;
&amp;gt;had checked it early on and it seemed to work fine.  now though i notice &lt;br&gt;
&amp;gt;that sometimes the file is empty, if the code encounters errors and quits. &lt;br&gt;
&amp;gt;Does diary wait until its associated mfile is finished to write to the &lt;br&gt;
&amp;gt;diary file?  I tested this by putting in a breakpoint after the diary file &lt;br&gt;
&amp;gt;was created and some text was displayed in the console, but before the main &lt;br&gt;
&amp;gt;mfile had finished.  i saw the diary .txt file, but nothing in it.  perhaps &lt;br&gt;
&amp;gt;it slows down execution if each text line in the console is written to the &lt;br&gt;
&amp;gt;diary file realitme.  Perhaps there is a buffer...?&lt;br&gt;
&lt;br&gt;
Try one of these two things:&lt;br&gt;
&lt;br&gt;
1) Create an onCleanup object whose cleanup function closes the diary.  I &lt;br&gt;
don't know if this will work if MATLAB crashes and terminates immediately, &lt;br&gt;
but it will close the diary if your function exits [thereby causing the &lt;br&gt;
onCleanup object to go out of scope.]&lt;br&gt;
&lt;br&gt;
2) Start MATLAB with the -logfile startup option.&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_env/f8-4994.html&quot;&gt;http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_env/f8-4994.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
I believe that doesn't buffer the same way DIARY does.&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com </description>
    </item>
    <item>
      <pubDate>Thu, 12 Mar 2009 17:09:17 -0400</pubDate>
      <title>Re: Diary quirkyness</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246457#634386</link>
      <author>Rune Allnor</author>
      <description>On 12 Mar, 00:59, &quot;Todd Welti&quot; &amp;lt;twe...@harman.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; I have some code that uses &quot;diary&quot; near the start to make a log file.&lt;br&gt;
&lt;br&gt;
You should be a bit carful about this. Things might have&lt;br&gt;
changed since then, but ten years ago, DIARY logged what&lt;br&gt;
went on in the command window. So anything that was not&lt;br&gt;
entered or displayed in the command window (like using F5&lt;br&gt;
to run a program from the editor window) was just missing&lt;br&gt;
from the diary file.&lt;br&gt;
&lt;br&gt;
Rune</description>
    </item>
    <item>
      <pubDate>Thu, 12 Mar 2009 17:20:22 -0400</pubDate>
      <title>Re: Diary quirkyness</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246457#634391</link>
      <author>Todd Welti</author>
      <description>Rune Allnor &amp;lt;allnor@tele.ntnu.no&amp;gt; wrote in message &amp;lt;43679d96-bbe2-4432-973b-673b2a88d7e3@e38g2000yqa.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; On 12 Mar, 00:59, &quot;Todd Welti&quot; &amp;lt;twe...@harman.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; I have some code that uses &quot;diary&quot; near the start to make a log file.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; You should be a bit carful about this. Things might have&lt;br&gt;
&amp;gt; changed since then, but ten years ago, DIARY logged what&lt;br&gt;
&amp;gt; went on in the command window. So anything that was not&lt;br&gt;
&amp;gt; entered or displayed in the command window (like using F5&lt;br&gt;
&amp;gt; to run a program from the editor window) was just missing&lt;br&gt;
&amp;gt; from the diary file.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Rune&lt;br&gt;
I tried to account for this by controlling the diary entry in the m file code itself (deleting existing diary file, starting new one and stopping diary at the end of the m file) .  But your point is still well taken.</description>
    </item>
    <item>
      <pubDate>Thu, 12 Mar 2009 20:39:34 -0400</pubDate>
      <title>Re: Diary quirkyness</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246457#634427</link>
      <author>Rune Allnor</author>
      <description>On 12 Mar, 18:20, &quot;Todd Welti&quot; &amp;lt;twe...@harman.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Rune Allnor &amp;lt;all...@tele.ntnu.no&amp;gt; wrote in message &amp;lt;43679d96-bbe2-4432-97=&lt;br&gt;
3b-673b2a88d...@e38g2000yqa.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; On 12 Mar, 00:59, &quot;Todd Welti&quot; &amp;lt;twe...@harman.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; I have some code that uses &quot;diary&quot; near the start to make a log file.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; You should be a bit carful about this. Things might have&lt;br&gt;
&amp;gt; &amp;gt; changed since then, but ten years ago, DIARY logged what&lt;br&gt;
&amp;gt; &amp;gt; went on in the command window. So anything that was not&lt;br&gt;
&amp;gt; &amp;gt; entered or displayed in the command window (like using F5&lt;br&gt;
&amp;gt; &amp;gt; to run a program from the editor window) was just missing&lt;br&gt;
&amp;gt; &amp;gt; from the diary file.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Rune&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I tried to account for this by controlling the diary entry in the m file =&lt;br&gt;
code itself (deleting existing diary file, starting new one and stopping di=&lt;br&gt;
ary at the end of the m file) . =A0But your point is still well taken.&lt;br&gt;
&lt;br&gt;
If you have one .m file that deletes a present diary file,&lt;br&gt;
and starts a new one, the diary file will be empty if&lt;br&gt;
nothing was communicated back and forth to the command window.&lt;br&gt;
With this approach, the diary file might at most contain&lt;br&gt;
any warnings, error messages or program output.&lt;br&gt;
&lt;br&gt;
Again, you need to be very careful about this, and make&lt;br&gt;
sure you understand exactly how the diary works. As well&lt;br&gt;
as being very pedantic about what functionality you want.&lt;br&gt;
&lt;br&gt;
Rune</description>
    </item>
    <item>
      <pubDate>Mon, 21 Mar 2011 19:53:08 -0400</pubDate>
      <title>Re: Diary quirkyness</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246457#826472</link>
      <author>Tom </author>
      <description>Rune Allnor &amp;lt;allnor@tele.ntnu.no&amp;gt; wrote in message &amp;lt;8fee2080-cde5-4ee6-a973-702c23c4ab0e@h20g2000yqn.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; On 12 Mar, 18:20, &quot;Todd Welti&quot; &amp;lt;twe...@harman.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; Rune Allnor &amp;lt;all...@tele.ntnu.no&amp;gt; wrote in message &amp;lt;43679d96-bbe2-4432-97=&lt;br&gt;
&amp;gt; 3b-673b2a88d...@e38g2000yqa.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; On 12 Mar, 00:59, &quot;Todd Welti&quot; &amp;lt;twe...@harman.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; I have some code that uses &quot;diary&quot; near the start to make a log file.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; You should be a bit carful about this. Things might have&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; changed since then, but ten years ago, DIARY logged what&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; went on in the command window. So anything that was not&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; entered or displayed in the command window (like using F5&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; to run a program from the editor window) was just missing&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; from the diary file.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Rune&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I tried to account for this by controlling the diary entry in the m file =&lt;br&gt;
&amp;gt; code itself (deleting existing diary file, starting new one and stopping di=&lt;br&gt;
&amp;gt; ary at the end of the m file) . =A0But your point is still well taken.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If you have one .m file that deletes a present diary file,&lt;br&gt;
&amp;gt; and starts a new one, the diary file will be empty if&lt;br&gt;
&amp;gt; nothing was communicated back and forth to the command window.&lt;br&gt;
&amp;gt; With this approach, the diary file might at most contain&lt;br&gt;
&amp;gt; any warnings, error messages or program output.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Again, you need to be very careful about this, and make&lt;br&gt;
&amp;gt; sure you understand exactly how the diary works. As well&lt;br&gt;
&amp;gt; as being very pedantic about what functionality you want.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Rune&lt;br&gt;
&lt;br&gt;
I just started using diary for the first time, and behavior was not what I expected after reading the documentation.  I'm running R2009a on Linux 2.6.9. Here's what I had to do to make it work:&lt;br&gt;
&amp;gt; diary filename.txt;&lt;br&gt;
&amp;gt; 'other Matlab commands here'&lt;br&gt;
&amp;gt; diary filename.txt;&lt;br&gt;
&lt;br&gt;
I started with the unquoted syntax and observed the file contents using &quot;tail -f filename.txt&quot; on a terminal.  Nothing happened, so I tried &quot;diary on&quot;.  Nothing happened, so I tried the quoted form of diary -- &quot;diary('filename.txt');&quot;.  At that point, all commands and output from the time of the first &quot;diary filename.txt&quot; command dumped to the file.  More experimenting showed quoted vs unquoted syntax doesn't matter, but I needed the second diary command to flush some buffer to fill the diary file.  Hope this helps. </description>
    </item>
    <item>
      <pubDate>Mon, 21 Mar 2011 20:06:59 -0400</pubDate>
      <title>Re: Diary quirkyness</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/246457#826474</link>
      <author>Steven_Lord</author>
      <description>&lt;br&gt;
&lt;br&gt;
&quot;Tom &quot; &amp;lt;tkopley@at.yahoo.dot.com&amp;gt; wrote in message &lt;br&gt;
news:im8ab4$mqg$1@fred.mathworks.com...&lt;br&gt;
&lt;br&gt;
*snip*&lt;br&gt;
&lt;br&gt;
&amp;gt; I just started using diary for the first time, and behavior was not what I &lt;br&gt;
&amp;gt; expected after reading the documentation.  I'm running R2009a on Linux &lt;br&gt;
&amp;gt; 2.6.9. Here's what I had to do to make it work:&lt;br&gt;
&amp;gt;&amp;gt; diary filename.txt;&lt;br&gt;
&amp;gt;&amp;gt; 'other Matlab commands here'&lt;br&gt;
&amp;gt;&amp;gt; diary filename.txt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I started with the unquoted syntax and observed the file contents using &lt;br&gt;
&amp;gt; &quot;tail -f filename.txt&quot; on a terminal.  Nothing happened, so I tried &quot;diary &lt;br&gt;
&amp;gt; on&quot;.  Nothing happened, so I tried the quoted form of diary --  &lt;br&gt;
&amp;gt; &quot;diary('filename.txt');&quot;.  At that point, all commands and output from the &lt;br&gt;
&amp;gt; time of the first &quot;diary filename.txt&quot; command dumped to the file.  More &lt;br&gt;
&amp;gt; experimenting showed quoted vs unquoted syntax doesn't matter, but I &lt;br&gt;
&amp;gt; needed the second diary command to flush some buffer to fill the diary &lt;br&gt;
&amp;gt; file.  Hope this helps.&lt;br&gt;
&lt;br&gt;
Turn diary logging on with the command DIARY using the file name; turn it &lt;br&gt;
off with DIARY OFF.&lt;br&gt;
&lt;br&gt;
diary mylogfile.txt&lt;br&gt;
% run some commands&lt;br&gt;
diary off&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com&lt;br&gt;
To contact Technical Support use the Contact Us link on &lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com&quot;&gt;http://www.mathworks.com&lt;/a&gt; </description>
    </item>
  </channel>
</rss>

