フィルターのクリア

Creating a variable number of prompts.

4 ビュー (過去 30 日間)
Steven Latham
Steven Latham 2019 年 12 月 10 日
コメント済み: Steven Latham 2019 年 12 月 11 日
So I'm just going to preface this saying that I'm very much still learning Matlab and not very proficent with the software yet.
My question is i'm trying to create a prompt that appears n times where n = an eariler input value. I have no idea where to begin with the code for this.
Here is what I have so far for this section. the end goal is to have the prompt appear like this:
Percent for test 1: xx.x
Percent for test 2: xx.x
......
Percent for last test: xx.x
prompt = {'Enter Your Name.', 'Number of Tests Taken. '};
dlgtitle = 'Name & Tests Taken';
dims = [1 50];
definput = {'Name','# of tests'};
answer = inputdlg(prompt,dlgtitle,dims,definput);
N = answer(1:1); % name entered in first box
T = answer(1:2); % Number of tests taken
TT = input('Percent for first test '); % Need to make varible # of prompts = T

採用された回答

Ridwan Alam
Ridwan Alam 2019 年 12 月 11 日
編集済み: Ridwan Alam 2019 年 12 月 11 日
prompt = {'Enter Your Name.', 'Number of Tests Taken. '};
dlgtitle = 'Name & Tests Taken';
dims = [1 50];
definput = {'Name','# of tests'};
answer = inputdlg(prompt,dlgtitle,dims,definput);
% you're good upto this point
N = answer{1}; % name entered in first box
T = str2num(answer{2}); % Number of tests taken
TT = zeros(T,1);
for i = 1:T
TT(i) = input(['Percent for test ',num2str(i),': ']);
end
%% TT stores all the scores
  1 件のコメント
Steven Latham
Steven Latham 2019 年 12 月 11 日
Thanks for the help this did the trick. Most everything is running smooth now.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by