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

336 Ansichten (letzte 30 Tage)
suyun
suyun am 9 Nov. 2012
Kommentiert: Jim Royalty am 17 Mai 2017
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

Akzeptierte Antwort

Image Analyst
Image Analyst am 9 Nov. 2012
Bearbeitet: Image Analyst am 9 Nov. 2012
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]);

Weitere Antworten (1)

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

Kategorien

Mehr zu Text Data Preparation finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by