Borrar filtros
Borrar filtros

How to make filename that message + date&time using [imwrite function].

4 visualizaciones (últimos 30 días)
The MATLAB code is {imwrite(red, datestr(now,'yyyy-mm-dd HH-MM-SS-FFF'),'png');}
I want to make file name "test_yyyy-mm-dd HH-MM-SS-FFF".png
Please, Let me know the method.
Thanks.

Respuesta aceptada

Kodavati Mahendra
Kodavati Mahendra el 5 de Jun. de 2018
Editada: Kodavati Mahendra el 5 de Jun. de 2018
filename = strcat(datestr(now,'yyyy-mm-dd HH-MM-SS-FFF'),'.png');
imwrite(red, filename);
Solved? Problem was with the syntax for imwrite :-)
Edit 1:
filename = strcat('Test_',datestr(now,'yyyy-mm-dd HH-MM-SS-FFF'),'.png');
imwrite(red, filename);
Now?
  3 comentarios
Kodavati Mahendra
Kodavati Mahendra el 5 de Jun. de 2018
You can just add your message string to the strcat function
Stephen23
Stephen23 el 5 de Jun. de 2018
Editada: Stephen23 el 5 de Jun. de 2018
@Junwon Park: using sprintf is often clearer than concatenating strings:
filename = sprintf('Test_%s.png',datestr(now,'yyyy-mm-dd HH-MM-SS-FFF'));

Iniciar sesión para comentar.

Más respuestas (1)

Junwon Park
Junwon Park el 5 de Jun. de 2018
Thank you so much. It's solved. :)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by