Borrar filtros
Borrar filtros

Creating a variable number of prompts.

4 visualizaciones (últimos 30 días)
Steven Latham
Steven Latham el 10 de Dic. de 2019
Comentada: Steven Latham el 11 de Dic. de 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

Respuesta aceptada

Ridwan Alam
Ridwan Alam el 11 de Dic. de 2019
Editada: Ridwan Alam el 11 de Dic. de 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 comentario
Steven Latham
Steven Latham el 11 de Dic. de 2019
Thanks for the help this did the trick. Most everything is running smooth now.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by