Display long statements on multiple lines in output
23 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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 个评论
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 Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!