필터 지우기
필터 지우기

display an input sentence to the user on multiple lines

조회 수: 28 (최근 30일)
lowcalorie
lowcalorie 2012년 3월 11일
coeff = input('Please enter the coefficients for the polynomial of the form ax^2 + bx + c = 0. Input all three values in this form [a b c] If a term is missing, use zero as a placeholder Input values (include square brackets): ');
this is an input function that tells the user to input 3 variables but as you can see this is very long and when i run it it displays this whole thing on one line
I need to display this on multiple lines in the command window i have tried doing ... but it has failed

채택된 답변

Oleg Komarov
Oleg Komarov 2012년 3월 11일
Use \n inside you string to have a newline
Example:
input(['Please enter the coefficients for the polynomial of the form ax^2 + bx + c = 0.',...
'\nInput all three values in this form [a b c].',...
'\nIf a term is missing, use zero as a placeholder.',...
'\nInput values (include square brackets): '])
Note that I broke the string for better readability. For instance if you remove the \n, even if you have on different lines in the editor, it will still be a single line in the command window.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by