I have the following code to read in a spreadsheet interprete the values and write out a letter grade instead of percentage to a new column also sending it back to the 2 of the book, here is the code.
clc;clear; [n,t,r] = xlsread ('grades(4).xlsx');lg = r; %create a new data
lg{1,3} = 'letter'; n = {n mean(n)};lg{1+length(n), 1} = 'Average';lg{1+length(n), 2} = 'mean(n)';for i = 1:length(n); if n(i) >= 0.9 lg{i+1, 3} ='A' elseif n(i) >= 0.8 lg{i+1, 3} ='B' elseif n(i) >= 0.7 lg{i+1, 3} ='C' elseif n(i) >= 0.6 lg{i+1, 3} ='D' else lg{i+1, 3} = 'F' end end xlswrite('grades(4).xlsx', lg, 'Sheet2');
Error message is the following:
Undefined function 'ge' for input arguments of type 'cell'.Error in HW6 (line 13) if n(i) >= 0.9
Have tried everything but can't seem to find anything.
Best Answer