How do I add date and time to my exel filename

3 vues (au cours des 30 derniers jours)
Richard Steinberger
Richard Steinberger le 25 Oct 2016
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."

Réponses (1)

Alexandra Harkai
Alexandra Harkai le 25 Oct 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')

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by