Could someone please help me with my boxplot?

1 次查看(过去 30 天)
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.

回答(1 个)

BhaTTa
BhaTTa 2024-9-10
@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!

Translated by