필터 지우기
필터 지우기

im trying to display grade scores and their letter grade.

조회 수: 2 (최근 30일)
Kaden
Kaden 2023년 4월 11일
편집: VBBV 2023년 4월 11일
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?

채택된 답변

VBBV
VBBV 2023년 4월 11일
for i = 1:length(s)
  댓글 수: 2
VBBV
VBBV 2023년 4월 11일
편집: VBBV 2023년 4월 11일
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 2023년 4월 11일
haha that was such a simple fix, thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by