Equivalent of "Enter"

73 views (last 30 days)
David Zhang
David Zhang on 21 Oct 2016
Commented: David Zhang on 22 Oct 2016
I'm writing a script, but when I use fprintf('The result is %d',y) and then the x=input('Enter x') in a new line on the script, when I run the script, both messages appear on one line. I was wondering if there is a way to make it so that each message appears on a new line, sort of like the equivalent of typing "Enter" when using Office word. Thanks!

Accepted Answer

KSSV
KSSV on 21 Oct 2016
Edited: KSSV on 21 Oct 2016
Add '\n' at the end of fprintf. This gives control to the next line.
fprintf('The result is %d\n',y) ;
x=input('Enter x:')

More Answers (0)

Categories

Find more on Shifting and Sorting Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!