Move diary in file to newfolder

23 views (last 30 days)
armin m
armin m on 6 Jul 2021
Commented: armin m on 6 Jul 2021
Hi.I export my output file to diary file.I want each time i run the code, matlab move diary file to a newfolder and rename the folder name to date and time of running can i do?

Accepted Answer

Peter O
Peter O on 6 Jul 2021
Hi Armin,
Try this at the start of your code. You may need to ensure the path exists before creating the diary file. You should get an error if that's the case, use mkdir for the path.
mypath = 'diaries'
myfile = "mydiary_" + datestr(now,30) + ".txt"
filepath = fullfile(mypath, myfile)
% Print location of diaryfile

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by