Using a histogram for cell array of letter grades
Show older comments
Hello,
I am trying to display the grade distribution showing frequency of grade by term of 4 total terms graphically. I am using a subplot to display all the data in one view.
Here is what I have:
% Subplot to show letter grade distribution
%by term
subplot(2,2,1)
hist(Fall2016_letter_grades)
title('Fall 2016 Grade Distribution')
xlabel('Letter Grade')
ylabel('Total')
subplot(2,2,2)
hist(Summer2016_letter_grades)
title('Summer 2016 Grade Distribution')
xlabel('Letter')
ylabel('Total')
subplot(2,2,3)
hist(Winter2016_letter_grades)
title('Winter 2016 Grade Distribution')
xlabel('Letter Grade')
ylabel('Total')
subplot(2,2,4)
hist(Fall2016_letter_grades)
title('Fall 2016 Grade Distribution')
xlabel('Letter Grade')
ylabel('Total')
When I try to execute the script I get this error
Error using hist (line 48) Input arguments must be numeric.
Error in grade_distribution_by_term (line 4) hist(Fall2016_letter_grades)
From the error message I can tell that the cell array of letter grades in this form Fall2016_letter_grades={'A', 'B', ....... etc} is causing the issue.
My attempts to convert the variable from str2num or str2double were unsuccessful
1 Comment
Rik
on 29 Mar 2017
It is best practice not to open a new question when it is a follow up question (which itself was a follow up to an answered question). I'm glad to see that you tried my suggestion of using a histogram, but please refer back to the original questions, after following these two links: here and here.
Answers (1)
Categories
Find more on App Building in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!