displaying date as title of figure
조회 수: 2 (최근 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!