printing string arrays in figure

14 ビュー (過去 30 日間)
Tintin
Tintin 2013 年 8 月 29 日
Hello, thanks for your help in advance!
I plan to output a string array t1, one by one in a for loop, in a figure. The problem I have is that the code I wrote only outputs the first letter of each string (e.g. 'O', then 'N', then 'D', etc). Is there a way to print out the complete string such as 'Oct', 'Nov' and so on? Thanks again.
t1 = str2mat('Oct', 'Nov', 'Dec', 'Jan', 'Feb', 'Mar');
figure;
for k = 1: 6
clf;
annotation('textbox', [0.2 0.4 0.1 0.1], ...
'String', t1(k), ...
'EdgeColor', 'none', ...
'HorizontalAlignment', 'center', 'FontSize', 16);
pause(0.50);
end

採用された回答

Tintin
Tintin 2013 年 8 月 29 日
OK thanks very much for your quick response!
  1 件のコメント
dpb
dpb 2013 年 8 月 29 日
Move comments to a comment section instead of answers...if it worked, please accept or at least vote... :)

サインインしてコメントする。

その他の回答 (1 件)

dpb
dpb 2013 年 8 月 29 日
annotation('textbox', [0.2 0.4 0.1 0.1], ...
'String', t1(k), ...
Use t1(k,:) instead or make the strings into cell strings
doc cellstr

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by