How do I add date and time to my exel filename

3 visualizzazioni (ultimi 30 giorni)
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."

Risposte (1)

Alexandra Harkai
Alexandra Harkai il 25 Ott 2016
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')

Categorie

Scopri di più su App Building in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by