MATLAB Answers

Creating a MatLab code to convert numerical grades into letter grades.

60 ビュー (過去 30 日間)
Robert Windham
Robert Windham 2019 年 9 月 21 日
コメント済み: Robert Windham 2019 年 9 月 22 日
Hey all!
I've currently working on creating a code that will allow me to convert numbers into a letter grade that can be put into a single column vector (1X25) and I can't figure out how to make it work. I thought I may have been onto something with this:
lg=mn; %lg is just what I'm calling letter grade and mn in the mean grade of the students assignments (also a 1X25).
if 90<=mn<=100
elseif 80<=mn<=89
elseif 60<=mn<=79
elseif 40<=mn<=59
elseif mn<40
I don't recieve any errors when I run it but it also doesn't provide me with any letter grades.
Any help would be greatly appreciated!

  2 件のコメント

David Hill
David Hill 2019 年 9 月 21 日
This provides a char array
Robert Windham
Robert Windham 2019 年 9 月 22 日
I tried doing this with a character array but because I want to include the 25X1 into another huge matrix, it messes up the rest of the matrix (looks like wingdings when I run the code).
Thank you, though!

サインイン to comment.

回答 (1 件)

madhan ravi
madhan ravi 2019 年 9 月 21 日
編集済み: madhan ravi 2019 年 9 月 21 日
You should loop through mn and save the results as a cell array in a variable which is preallocated before loop using indexing. Or better just use logical indexing and store the results as a cell array.

  0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。

Translated by