MATLAB: Matlab Grade book help –drop one lowest score and assigning letter grade

gradebookhomeworkMATLABstatisticssum

Hi I am building a gradebook that allows me to drop the lowest assignment score and only takes 10 assignment scores and adds all the test scores. I need to assign a letter grade to each student.
Here is some data
I am stuck on dropping the lowest score and assigning students to a grade in my function. if there is a better way of doing it without a function… please tell me…
function [sumarr] = grades(structure, field)
% FUNCTION GRADES accepts any cell array value and assigns a letter
% all data entered must be transposed from rows to colums please remember
% to transpose data example transposedata = data' ---> data = [FILE that
% was imported]
%DEFINE VARIABLES
% ii -- index variable
ii =0 ;
array =[];
for ii = 1:length(structure)
%build an array
array = [array structure(ii).(field)];
end
% if one grade is less than 2, drop the score.
% assign Letter grades
%sum of all grades
sumarr = sum(array);
end

Best Answer

Can you try just subtracting the min, something like
array = [structure.(field)]; % All items - no loop over ii needed.
arraySum = sum(array) - min(array);
Related Question