Creating a diary that is not appended to an existing one.
Mostrar comentarios más antiguos
According to Matlab documentation when turning on the diary it appends the commands to the existing diary of the same name. Is there a way not to append, that is to start the diary file afresh? Thanks Tomy
Respuesta aceptada
Más respuestas (2)
WAT
el 30 de Sept. de 2015
if (exist(filename))
delete(filename);
end
4 comentarios
Jan
el 30 de Sept. de 2015
Be careful with the exist command. It accepts existing variables, Java classes and so on. Better:
if exist(FileName, 'file')
But even this accepts folders with this name.
WAT
el 30 de Sept. de 2015
so I guess
if (exist(Filename, 'file') == 2))
to be even safer then?
Tomy Duby
el 5 de Oct. de 2015
Walter Roberson
el 5 de Oct. de 2015
I would speculate that at the time you delete() that the current directory is no longer the same directory you created the diary in. Remember that it is always safer to fully-qualify file names.
Walter Roberson
el 30 de Sept. de 2015
0 votos
3 comentarios
Tomy Duby
el 30 de Sept. de 2015
Walter Roberson
el 30 de Sept. de 2015
Xiaodi
el 3 de Sept. de 2017
I guess, before you delete mydiary.out file, you must
diary off
to close the diary process and then maybe you can delete this mydiary.out file, which is created by
diary('mydiary.out')
Categorías
Más información sobre Share and Distribute Software en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!