Saving a .txt with Month/Day in filename
Afficher commentaires plus anciens
Hello MW forum!
I'd like to save a big matrix to an ascii file as double, but I'd like the date (preferably the month/day) added to the filename before the '.txt'...
I was using something like:
save('good_series.txt', matrix_variable, '-ascii', 'double')
and Ive tried a few other things where I try to pass the date in as an argument to a filename, but it was unsuccessful. I'd like to avoid using solutions with f* anything.. fid, fopen, etc.
Thank you in advance for your suggestions and help.
Sincerely,
Michael
4 commentaires
Matt Kindig
le 21 Oct 2013
Why not something like this:
filename = sprintf('good_series%s.txt', datestr(now,'dd-mmm-yyyy'));
save(filename, matrix_variable, '-ascii', 'double');
Michael
le 21 Oct 2013
Matt Kindig
le 21 Oct 2013
Modifié(e) : Matt Kindig
le 21 Oct 2013
Is 'matrix_variable' the actual name of the variable to save, or is it a string containing the name of the variable? Because if it is the former, you need to wrap it in quotes, like:
filename = sprintf('good_series%s.txt', datestr(now,'dd-mmm-yyyy'));
save(filename, 'matrix_variable', '-ascii', 'double');
Michael
le 22 Oct 2013
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Dates and Time dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!