Append current date to filename
Show older comments
Hello everyone,
I have a simulink code which writes a structure called 'state' to the workspace containing multiple outputs which I would like to save to a .mat file by running a post processing script, eventually through a callback function. I am currently trying to append the current time and date to the output file. I have gotten the file to save in the specified location but have been unable to append the current date/time to the file name. I have included the path because I would like to save the output files to their own folder, not simply the current folder.
This was my latest attempt..
Any help would be appreciated.
Cheers!
t = datetime('now', 'Format','yyyy_MM_dd,HH_mm');
DateString = datestr(t)
FileName=[DateString,' Output ','JohnSmith']
save('/Users/John/Desktop/Project1/Matlab Model/'FileName,'state')
Answers (0)
Categories
Find more on Naming Conventions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!