필터 지우기
필터 지우기

Display long statements on multiple lines in output

조회 수: 25 (최근 30일)
Swasti Khuntia
Swasti Khuntia 2012년 9월 6일
편집: Mohammed Musleh 2018년 9월 24일
Hello All,
I want to include some texts in the description of a structure. But it#s too long to be displayed in a single line. I want that to be displayed in 2 or 3 lines.
Any suggestions on how to do it?
Thanks

채택된 답변

José-Luis
José-Luis 2012년 9월 6일
One way to go. Insert newline in your string, and display using fprintf:
yourString = 'One line \n Two line \n Three line';
fprintf(your_String);
  댓글 수: 4
Swasti Khuntia
Swasti Khuntia 2012년 9월 6일
Thanks a lot !!! It' perfect !!!
Mohammed Musleh
Mohammed Musleh 2018년 9월 23일
편집: Mohammed Musleh 2018년 9월 24일
Doing this in 2018, on version 2018a, Matlab is suggesting that I switch "char(10)" with just "newline" (outside of the single quotes). Works well.
But I prefer the compose function: https://www.mathworks.com/help/matlab/ref/compose.html

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by