Effacer les filtres
Effacer les filtres

Creating a variable number of prompts.

4 vues (au cours des 30 derniers jours)
Steven Latham
Steven Latham le 10 Déc 2019
Commenté : Steven Latham le 11 Déc 2019
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

Réponse acceptée

Ridwan Alam
Ridwan Alam le 11 Déc 2019
Modifié(e) : Ridwan Alam le 11 Déc 2019
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 commentaire
Steven Latham
Steven Latham le 11 Déc 2019
Thanks for the help this did the trick. Most everything is running smooth now.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by