UPDATE: I have gotten the file to save with the current date using the following code:
t = datetime('now','Format','yyyy-MM-dd''_T''HHmmss')
t2 = datevec(t)
DateString = datestr(t2)
FileName=[DateString,' Output ','JohnSmith']
save( fullfile('/Users/John/Desktop/Project1/Matlab Model/', FileName) )
My issue now is that I want the files to save in the format specified using datetime, namely 'yyyy-MM-dd', however whenever I convert the files using DataString, Matlab converts them to the format:
'30-Mar-2019 13:29:35 Output JohnSmith'
This messes up the file ordering. What is the best way to prevent this? I could not get the 'datenum' or 'datevec' commands to work as suggested by some of the threads I was reading.
Thanks!