Could someone please help me with my boxplot?

2 Ansichten (letzte 30 Tage)
Student
Student am 12 Apr. 2016
Beantwortet: BhaTTa am 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.

Antworten (1)

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

Kategorien

Mehr zu Data Distribution Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by