If you have data in a vector X
, which you want to be plotted in several boxplots, create a new vector G
, the same size as X
with a 1 for the first boxplot, 2 for the second, etc.
For example, you want to plot a boxplot for 1 2 3 4 5 6
and another for 7 8 9 10
.
X=[1 2 3 4 5 6 7 8 9 10];
G=[1 1 1 1 1 1 2 2 2 2];
boxplot(X,G)