MATLAB: Creating a diary that is not appended to an existing one.

diaryMATLAB

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

Best Answer

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'])