Could someone please help me with my boxplot?

1 view (last 30 days)
Student
Student on 12 Apr 2016
Answered: BhaTTa on 10 Sep 2024
I am told to graph box plots of "total alarm use" by gender.
The variable useAlarm has the data for the number of times an alarm was used in order to wake up and is (21x144 logical).
In order to separate the data by gender I typed this into matlab:
men = strcmp(gender, 'male');
totalmen = sum(men);
alarmmen = useAlarm(:, men);
women = strcmp(gender, 'women);
totalwomen = sum(women);
alarmwomen = useAlarm(:, women);
Then, I set up an "alarm" variable to place it in the graph:
alarm = useAarm([alarmmen, alarmwomen}], gender);
which keeps saying "error"
Now, I think to plot the boxplots all I have to type in is:
figure
boxplot(alarm, gender);
ylabel('Number of times alarm was used')
title('Comparison of alarm use by gender')
Could someone please help me figure out how I am suppose to use my "alarm" variable in order to plot the boxplot?
Thank you, I appreciate the help.

Answers (1)

BhaTTa
BhaTTa on 10 Sep 2024
@Student, the error you see here is because there is a typo in your alarm variable definition (useAarm should be useAlarm).

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!