Question answered, thanks: question on line break using fprintf
Ältere Kommentare anzeigen
Hi
I need to write several lines of text to the user. I am using fprintf, but even though I write the text on consecutive lines, using fprintf each time, it all gets put together to one long string when I execute the program. Could someone please tell me how I get line breaks in the text?
Thanks a bunch!
Akzeptierte Antwort
Weitere Antworten (1)
James Tursa
am 31 Mär. 2015
Include the newline \n at the end of the text where you want the line break. E.g.,
fprintf("This is the first line\n");
fprintf("This is the second line\n");
3 Kommentare
Karen Christensen-Dalsgaard
am 31 Mär. 2015
Karen Christensen-Dalsgaard
am 31 Mär. 2015
Image Analyst
am 31 Mär. 2015
Karen, note that /n is different than \n. The backslash is a special character that means the next character has a special meaning, while the forward slash is just a regular character. That's why you saw what you saw.
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!