Help with conditional statements
Afficher commentaires plus anciens
Dear all,
I am new to matlab and I am trying to solve the following question... I already tried the help function and google, but I am kind of stuck. The question is: A student passes the exam if the grade on each of the four tests is greater or equal to 6. If this requirement is not met (that is, at least one of the four tests was graded with 5 or less), the student can pass the exam, performing an additional resit test, if the average score (on the four tests) is greater or equal to 6, otherwise the exam is failed. This is as far as I got... (The first column is the ID of the student, columns 2-4 are restults of individual tests)
Scores= [1 7 10 9 9;2 6 8 7 6;3 9 10 10 9;4 4 7 6 5;5 7 8 8 9; 6 8 10 9 10; 7 5 6 7 6; 8 8 9 7 6; 9 7 8 8 5; 10 8 10 8 10]
ScoresMean=Scores; ScoresMean(:,1)=[]; mean(ScoresMean,2) % gives mean scores (per row)
ScoresNoID=Scores; ScoresNoID(:,1)=[]; if ScoresNoID(1,:)>6 disp('pass') elseif ScoresNoID(1,:)<6 disp('fail') if ScoresNoID(1,:)<6 = mean(ScoresNoID,2)>6 % this might be wrong... disp('resit')
as you can see, I am already stuck at the beginning. I would appreciate any help!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!