Creating a diary that is not appended to an existing one.
20 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Dave
2017-11-9
To have the diary name with the date and time when starting use this command:
diary(['gd_diary_',datestr(now,'dd-mm-yy','local'),'_',datestr(now,'hh-MM-ss','local'),'.txt'])
0 个评论
更多回答(2 个)
WAT
2015-9-30
if (exist(filename))
delete(filename);
end
4 个评论
Walter Roberson
2015-10-5
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
2015-9-30
3 个评论
Walter Roberson
2015-9-30
Xiaodi
2017-9-3
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')
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 File Operations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!