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

조회 수: 182 (최근 30일)
suyun
suyun 2012년 11월 9일
댓글: Jim Royalty 2017년 5월 17일
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'});
  댓글 수: 1
Jim Royalty
Jim Royalty 2017년 5월 17일
This answer works. My \n didn't.

댓글을 달려면 로그인하십시오.

카테고리

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