I am guessing that your Excel spreadsheet has a header row, an answer key row, then a row per student with their answers. You imported the excel data as a cell array of strings called raw. Also, the first six rows are not used here; the first question's key and answers are in column 7. Is that correct?
If so, try the following:
Extract your data from the raw cell array
key = raw(2, 7:end);
answers = raw(3:end, 7:end);
Compare it all at once using strcmp
num_correct = sum(strcmp(answers, repmat(key, num_students, 1)), 2);
Plot the results as a bar chart
No for loops needed!