How do I add date and time to my exel filename
2 次查看(过去 30 天)
显示 更早的评论
filename = strcat('Solution_',date,'.xlsx'); sheet = 1; xlRange = 'A3'; xlswrite(filename,transpose(P),sheet,xlRange) xlRange = 'B2'; xlswrite(filename,T,sheet,xlRange) xlRange = 'B3'; xlswrite(filename,n_max_Methanol,sheet,xlRange)
It is working like this with an Date but i can t get it to work with date and ime in the Title, when I suplement date with datetime it says : "Comparison is not defined between datetime and double arrays."
0 个评论
回答(1 个)
Alexandra Harkai
2016-10-25
This produces an 'ugly' filename but it gets through the datetime->char conversion:
filename = strcat('Solution_',datestr(datetime),'.xlsx')
You can specify a format using underscore instead of the space, for example:
filename = strcat('Solution_',datestr(datetime,'dd-mmm-yyyy_HH:MM:SS'),'.xlsx')
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!