フィルターのクリア

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 Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by