next line, new line! in the text( ) code

129 次查看(过去 30 天)
I want to write text using text code
text(5,5,['MATLAB','\n']);
but '\n' doesn't work.
I want a textbox consisting of three text lines

采纳的回答

Image Analyst
Image Analyst 2012-11-9
编辑:Image Analyst 2012-11-9
Try sprintf:
message = sprintf('Line #1\nThe second line.\nAnd finally a third line.');
plot(1:20);
text(5, 5, message, 'FontSize', 20, 'Color', [.6 .2 .6]);

更多回答(1 个)

Jan
Jan 2012-11-9
text(5, 5, ['MATLAB', char(10), 'Line 2']);
text(10, 5, {'MATLAB2', 'Line 2'});

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by