displaying date as title of figure
    4 次查看(过去 30 天)
  
       显示 更早的评论
    
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 个评论
采纳的回答
  Walter Roberson
      
      
 2017-10-26
        caption = datestr(q{:,1}(1,1));
It is already text: you do not need to format it.
0 个评论
更多回答(1 个)
  Fangjun Jiang
      
      
 2017-10-26
        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 个评论
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Title 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


