How do you store input to a list?

19 ビュー (過去 30 日間)
goodwin membreve
goodwin membreve 2020 年 10 月 27 日
回答済み: Adam Danz 2020 年 10 月 27 日
ecprompt='Counts of Equation?';
eqcount=inputdlg(ecprompt);
eqprompt='Enter Equation (from highest to lowest degree):';
equation=inputdlg(eqprompt);
I want to ask how can you ask the user to make another input and then storing the input to future use.
Basically what i want to happen is i will ask the user how many equations they have and then ask them nth times depending on the number they put. And then how do i store the inputs to a list?

回答 (1 件)

Adam Danz
Adam Danz 2020 年 10 月 27 日
Store responses in a cell array
n = 5; %number of questions you're asking
response = cell(n,1);
ecprompt='Counts of Equation?';
response{1} = inputdlg(ecprompt);
eqprompt='Enter Equation (from highest to lowest degree):';
response{2} = inputdlg(eqprompt);
Or ask all questions at once,
prompts = {'Counts of Equation?', 'Enter Equation (from highest to lowest degree):'};
response = inputdlg(prompts)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by