urgent help, please
조회 수: 3 (최근 30일)
이전 댓글 표시
Imagine,
N=input("Enter the number of storeys: ")
m1=input("what is you m1 value? ")
As you see in the first command i ask a user to input the number of storeys. Now, my question is that i want the m1 input command to pop up N times which was entered in the first command. How can I possibly do this?
Can anyone help me on this basic issue? Thank you!
댓글 수: 0
답변 (1개)
Deepak Gupta
2020년 5월 26일
If you want to enter the values one by one, then you can use a loop:
N=input("Enter the number of stories: ")
for index = 1:N
m1(index)=input("What is your m1 value? ")
end
댓글 수: 5
Steven Lord
2020년 5월 26일
See this answer for some of the many reasons to avoid creating many individual scalar variables with numbered names.
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!