Display long statements on multiple lines in output
25 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Swasti Khuntia
le 6 Sep 2012
Modifié(e) : Mohammed Musleh
le 24 Sep 2018
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 commentaires
Réponse acceptée
José-Luis
le 6 Sep 2012
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 commentaires
Mohammed Musleh
le 23 Sep 2018
Modifié(e) : Mohammed Musleh
le 24 Sep 2018
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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!