Borrar filtros
Borrar filtros

im trying to display grade scores and their letter grade.

2 visualizaciones (últimos 30 días)
Kaden
Kaden el 11 de Abr. de 2023
Editada: VBBV el 11 de Abr. de 2023
im trying to display the letter grades from vector with disp() along with thier letter grades according to a grading scheme like this.-
grades = strings(size(S));
for i = 1;length(s)
if S(i) > Av + 1.3*Sd
grades(i) = "A";
elseif S(i) > Av + 0.5*Sd
grades(i) = "B";
elseif S(i) > Av - 0.5*Sd
grades(i) = "C";
elseif S(i) > Av - 1.3*Sd
grades(i) = "D";
else
grades(i) = "F";
end
end
and it shows all the grades and displays correctly but only shows the first letter grade and not the other 22. does anyone know how to fix this?

Respuesta aceptada

VBBV
VBBV el 11 de Abr. de 2023
for i = 1:length(s)
  2 comentarios
VBBV
VBBV el 11 de Abr. de 2023
Editada: VBBV el 11 de Abr. de 2023
The for loop is incorrect in your code. Change it as above by using : in place of ; By using ; the index i is set to 1 and not incremented to all values.
Kaden
Kaden el 11 de Abr. de 2023
haha that was such a simple fix, thank you!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical 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