MATLAB: Xlswrite include date and time in filename

xlswrite

I can use xlswrite to write to a file.
For example write matrix Datatemp1 to sheet temp in filename.xlsx the code is
xlswrite('C:\path\filename.xlsx',Datatemp1, 'temp');
I want to include the date and time of the file in the name. I'll be collecting several files across days, and do not want one to overwrite the previous file.
thanks

Best Answer

Specify your file name such:
FileName=sprintf('FileName_%s.xlsx',datestr(now));