displaying date as title of figure

4 ビュー (過去 30 日間)
AA
AA 2017 年 10 月 26 日
回答済み: Fangjun Jiang 2017 年 10 月 26 日
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?

採用された回答

Walter Roberson
Walter Roberson 2017 年 10 月 26 日
caption = datestr(q{:,1}(1,1));
It is already text: you do not need to format it.

その他の回答 (1 件)

Fangjun Jiang
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'.

カテゴリ

Help Center および File ExchangeTitle についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by