Help placing user input into an element in a row vector
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
This is what I have so far, having trouble adding user input into a row vector the same amount of times as for loop
score =inputdlg('Please enter a number of scores between 1 and 10:\n'); % Prompt and Get a score input
data = str2double(score);
x = [];
if 1<= data && 10>=data
for i = 1 < score
x(end+1) = input('Input a number: ');
end
else
errordlg('Wrong Input')
end
0 commentaires
Réponses (2)
per isakson
le 28 Mar 2021
2 commentaires
per isakson
le 29 Mar 2021
Modifié(e) : per isakson
le 29 Mar 2021
The operator ':' appears in the for-statement and the value of the variable, data, should be double. That error should not occur. Did you really use the for-statement
for i = 1 : data
If you did, run
whos data
and show me the output
Voir également
Catégories
En savoir plus sur Startup and Shutdown 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!