xlsGrades - col_avg = [avg_ind;avg_total]; %vertically...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function [cellu,chara] = xlsGrades(chara2) %function to compute the class average from an excel spreadsheet; then add %class average to the first column below the last student's name; compute %each individual average and concatenate it with the array; add student %average above this data; compute class average for all tests; return the %name of the student with the highest class average %usage: [cellu,chara] = xlsGrades(chara2) [num,txt,raw] = xlsread(chara2); %this will produce the arrays of all the numbers, text, and total cell %array of the data from the xls file avg_test = mean(num); %finds the average of all of the tests avg_ind = mean(num')'; %finds the average of all of the individuals avg_total = mean(mean(num)); %finds the total mean of the array of numbers [r c] = size(raw); %finds the number of rows and columns of the raw data raw{r+1,1} = 'Class Average'; %adds the Class Average string to the raw data raw{1,c+1} = 'Student Average'; %adds the Student Average string to the raw data
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: col_avg = [avg_ind;avg_total]; %vertically concatenates the ind avg and the total avg for a = 2:r raw{a,c+1} = avg_ind(a-1); end %creates a for loop to access each individual cell in the raw data to %insert the appropriate values row_avg = [num;avg_test]; %vertically concatenates the test avg and the num array num = [row_avg,col_avg]; %concatenates all of the averages together for b = 2:c raw{r+1,b} = avg_test(b-1); end %creates a for loop to access each individual cell in the raw data to %insert the appropriate values raw{end,end} = avg_total; %places the final average in the bottom right corner maximum = max(avg_ind); ind = find(avg_ind==maximum); %finds the position of the maximum value in the avg ind vector students = raw(2:r,1); %finds the names of the students chara = students{ind}; %finds the student that has the highest grade average cellu = raw; end e...
View Full Document

This note was uploaded on 10/21/2010 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Tech.

Ask a homework question - tutors are online