필터 지우기
필터 지우기

when an input is too long, how can I use ... as part of the input statement?

조회 수: 2 (최근 30일)
Muazma Ali
Muazma Ali 2019년 8월 25일
댓글: Stephen23 2019년 8월 26일
my input resemble this statement
combinations_available=input('Enter the number associated with the combination of salts available. Enter 0 if none of the combinations are available. 1: Only Cloride-salts are available. 2: ZnBr is available with one Cloride salt . 3: NH4Cl2 is availble with: 1) CH3CO2K, 2) ZnSO4, 3) HCOONa, 4)HCOOK, 4: ZnBr is available with: 1) CH3CO2K, 2) ZnSO4, 3) HCOONa, 4)HCOOK , 5: CH3CO2K is available with one of these chlorides: 1) NH4Cl2, 2) MgCl2, 3) CaCl2, 4) NaCl, 5) KCl
And I want the all alternatives after the different numbers that are separated with ' : ' displayed on different line one after the other
I have tried .. within the input statement but it didnt work

답변 (1개)

the cyclist
the cyclist 2019년 8월 25일
This answer to a similar question gives this answer that I beileve you can adapt:
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): '])
  댓글 수: 2
Guillaume
Guillaume 2019년 8월 25일
편집: Guillaume 2019년 8월 25일
I'd personally write the \n at the end of a line, not at the begging of the next one but yes, use '\n' to insert a new line symbol, not ...
Muazma Ali
Muazma Ali 2019년 8월 26일
thanks all of you, I willl try your suggetions

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by