xlswrite include date and time in filename

3 views (last 30 days)
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

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 20 Aug 2011
Specify your file name such:
FileName=sprintf('FileName_%s.xlsx',datestr(now));
  12 Comments
aryan PATEL
aryan PATEL on 3 Aug 2015
thank you very much for the solution Oleg

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!