How to use boxchart()?

84 views (last 30 days)
Louise Wilson
Louise Wilson on 13 Nov 2020
Commented: Fuqiang Guo on 23 Dec 2021
I am trying to use a boxchart for the first time as opposed to a boxplot, as it looks to have better functionality for what I want to do.
But, it's not working and I can't understand what's wrong...
On the x axis I would like to have 22 different dates, represented on the y by a box plot of 22*144 data points.
Error using boxchart
Expected ydata to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64
Error in boxchart (line 95)

Accepted Answer

Cris LaPierre
Cris LaPierre on 13 Nov 2020
Edited: Cris LaPierre on 13 Nov 2020
I think the error is because you are using the syntax boxchart(xgroupdata,ydata), but your inputs are reversed. You put the grouping variable second. Also, your grouping data is not valid for use as xgroupdata.
From the documentation, if you want to use a cell array of characters, you must use the syntax
Therefore, try changing your code to
Fuqiang Guo
Fuqiang Guo on 23 Dec 2021
Thank you very much, your advice is very helpful, I'll update my software version

Sign in to comment.

More Answers (0)





Community Treasure Hunt

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

Start Hunting!