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

398 visualizaciones (últimos 30 días)
suyun
suyun el 9 de Nov. de 2012
Comentada: Jim Royalty el 17 de Mayo de 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

Respuesta aceptada

Image Analyst
Image Analyst el 9 de Nov. de 2012
Editada: Image Analyst el 9 de Nov. de 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]);

Más respuestas (1)

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

Categorías

Más información sobre Numeric Types en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by