Problems with the .log-file

I have the following problem:

I do SMM with dynare. Since I use the from the .mod-file generated .m-file for minizisation of my distance function.

  1. question:
    what does this code do?
    diary off;
    logname_ = ‘DSGE.log’;
    if exist(logname_, ‘file’)
    What is the diary command doing?

  2. When I do iteration, I often get the following error message:
    Warning: File not found or permission denied
    regarding the .log-file

What should I do to solve this problem?


The diary command in Matlab writes all output in the command window into a textfile. The mentioned code stops all previous diaries, then deletes the log-file potentially already present (the if part) and starts a new diary. The problem with calling Dynare repeatedly is that sometimes Matlab is not fast enough with closing the text-files, leading to crashs. However, I am not aware of a command to suppress writing a diary. However, it might be sensible to implement such a command in the future.

Okay, thank you.

For everyone with the same problems:
Let your iteration don’t go to far, so that you can save your results, and start the iteration again with these new results, otherwise you will lost a lot of time.

A new option “nolog” has been added to the Dynare preprocessor in the unstable branch. It will be included in the future Dynare 4.3 release.