1
votes

I have three vectors if different size (86x1 double), (61x1 double) and (10x1 double).

I try:

figure
boxplot([x1,x2,x3])  

but get "error using horzcat, dimensions of matrices being concatenated are not consistent".

I've tried transposing the vectors but it looks like it combines these into one group and does a boxplot for that. i.e. if i have

boxplot([x1,x2,x3],'Labels','thing1','thing2','thing3')  

I get:

"Struct contents reference from a non-struct array object.

Error using boxplot>assignUserLabels (line 1688) There must be the same number of labels as groups or as the number of elements in X."

1

1 Answers

2
votes
g1 = ones(size(x1)) * 1;
g2 = ones(size(x2)) * 2;
g3 = ones(size(x3)) * 3;
figure()
boxplot([x1; x2; x3], [g1; g2; g3], 'Labels', {'thing1', 'thing2', 'thing3'})