Saving a .txt with Month/Day in filename
Mostrar comentarios más antiguos
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 comentarios
Matt Kindig
el 21 de Oct. de 2013
Why not something like this:
filename = sprintf('good_series%s.txt', datestr(now,'dd-mmm-yyyy'));
save(filename, matrix_variable, '-ascii', 'double');
Michael
el 21 de Oct. de 2013
Matt Kindig
el 21 de Oct. de 2013
Editada: Matt Kindig
el 21 de Oct. de 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
el 22 de Oct. de 2013
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!