displaying date as title of figure
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
AA
el 26 de Oct. de 2017
Respondida: Fangjun Jiang
el 26 de Oct. de 2017
hi, i want to display a date as title of a figure.
caption = sprintf(' %.3f', datestr(q{:,1}(1,1)));
This q cell array contains a dateserial number. When I display it as datestr then I get random numbers but not the actual date. How can I change that?
0 comentarios
Respuesta aceptada
Walter Roberson
el 26 de Oct. de 2017
caption = datestr(q{:,1}(1,1));
It is already text: you do not need to format it.
0 comentarios
Más respuestas (1)
Fangjun Jiang
el 26 de Oct. de 2017
The output of datestr() is already a string, so you don't need to use sprintf() anymore. Use datastr() directly.
If you still need to use sprintf(), then use '%s' instead of '%.3f'.
0 comentarios
Ver también
Categorías
Más información sobre Title en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!