Diary and logfile are empty until I close them: how to fix this?

8 views (last 30 days)
I use the -logfile option and the diary command to track the progresses of my codes. In fact, sometimes during the runs (that take days) MATLAB graphical interface freezes and the only way to check the progress is to look at the output in the command window. However, I realized that the most recent versions (2009+) write the logfile and the diary only when the file is finally closed. While the file is still open, it is just a 0kb empty file. For the diary, I solved adding commands
diary; diary;
that close and reopen the diary, so it is written down, but for the logfile there is no solution.
Is there anybody that can help?
Besides, if anybody can tell me a procedure to "unfreeze" the user interface without aborting the computation, it would be great! (I use WinXP and Win7).
  1 Comment
Eric Zhang
Eric Zhang on 23 Jul 2016
Having the same problem here. Didn't expect such a straightforward demand to be so hard to meet.

Sign in to comment.

Answers (1)

Doug Hull
Doug Hull on 21 Jan 2011
If you have long running programs like this, I would want to be more explicit about the saving of data in the middle and creating of log files. This will give you greater control over what is put in the file, and when it is saved.
Also, for long running code, have you considered using sendmail.m to send periodic updates? What about some of the File Exchange entries that allow you to tweet from MATLAB? Both of these can be useful for remote monitoring of long term runs.
  1 Comment
Paolo Bocchini
Paolo Bocchini on 21 Jan 2011
Thank you for the suggestions, I really appreciate them.
However, they do not address my question.
In the latest versions, Matlab's logfile (the one created with "matlab.exe -logfile") is actually written only when Matlab is closed.
Similarly, the output of the "diary" command is actually written only when the diary is turned off.
Is there a way to change this behavior?
Thank you again!

Sign in to comment.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!