Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Creating multiple boxplots from a single vector

Asked by Kitae on 3 Jun 2013

Hello, I need to create a boxplot for each quarter of range of years that user inputs. For example, If user wants a info from 1990~1994, I need to have 20 boxplots that shows data each quarter of each years. So I was wondering If there is anyway I can create a plot with multiple boxes from a single vector, such that if I happen to plot 1990~1991, the vector will be x=[1:24] (24 months), i get 8 boxes. I know that if I create a group vector such as g=[1,1,1,2,2,2,3,3,3,...8,8,8] and do boxplot(x,g), i will get 8 boxes. However, i dont know to create a group vector that relies on user's input, which is the number of years.

If you can help, it would be great. Thank you.

0 Comments

Kitae

Tags

Products

No products are associated with this question.

1 Answer

Answer by Tom Lane on 3 Jun 2013

Are you looking for this?

nyears = 5;
g = kron((1:nyears)',[1;1;1;1])

0 Comments

Tom Lane

Contact us