How can i keep asking them the same inputdlg based on how many they want to input?
조회 수: 2 (최근 30일)
이전 댓글 표시
count='How many values do you want?';
vcount=inputdlg(count);
eqprompt='Enter Values';
value(vcount)=inputdlg(eqprompt);
eqprompt='Enter Values';
value(vcount)=inputdlg(eqprompt);
How to repeat the "Enter Value' dialog box until the count is equal to the number of times it repeat?
댓글 수: 0
채택된 답변
Jakob
2020년 10월 28일
count='How many values do you want?';
vcount=inputdlg(count);
vcount = str2double(vcount{1});
eqprompt='Enter Values';
value = [];
for i = 1 : vcount
answer =inputdlg(eqprompt);
try value(1, i)= str2double(answer{1}); %this is for empty input. In case you changed your mind with the number of inputs
catch
break;
end
end
댓글 수: 2
Jakob
2020년 10월 28일
You could try it with
split('4x^4 +4x^3 -2x^2', ["x^" , " "])
but I'm not sure, how to handle this :(
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Import, Export, and Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!