How can i keep asking them the same inputdlg based on how many they want to input?

1 次查看(过去 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?

采纳的回答

Jakob
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 个评论
goodwin membreve
goodwin membreve 2020-10-28
THANK YOU!! i have another question, what if i want the user to enter polynomial equations and only store the coefficient of each term?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graph and Network Algorithms 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by