My first user-input prompt is to enter a number (say, x). What should I write if my next message box MUST contain the same number of prompt questions as x?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi! My first user-input prompt is to enter a number (say, x). What should I write (code) if my next message box MUST contain the same number of prompt questions as x?
댓글 수: 0
채택된 답변
Steven Lord
2022년 8월 22일
I'd use a string array. I'm going to hard code the value of n to keep this example simple, but you could query for it using a dialog.
n = 5;
questions = "Enter the value for element number " + (1:n);
inputdlg(questions)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!