export CSV file with timestamp in filename
4 次查看(过去 30 天)
显示 更早的评论
I want to export some data using writetable into a .csv file but I also want a timestamp in the name of the .csv file. I have been able to export the data to a .csv file and I have been able to export the data with the timestamp but ONLY as a .txt file. Any advice??
0 个评论
采纳的回答
Star Strider
2015-2-2
I’m not certain exactly what you want, but this will get you started:
filename = sprintf('CSV File %s.csv', datestr(now));
produces:
filename =
CSV File 02-Feb-2015 10:16:58.csv
You can specify the format of the timestamp with the ‘formatOut’ parameter of datestr, for example:
filename = sprintf('CSV File %s.csv', datestr(now, 'dd.mm.yyyy HH:MM'))
produces:
filename =
CSV File 02.02.2015 10:20.csv
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Data Preparation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!