MATLAB: Extracting the median of a boxplot

boxplot

hie. i have 6 boxplot figures like what i have attached to this post. all i want is to extract the median values of each box in the first subplot of each figure. can anybody help pls?

Best Answer

From the documentation:
  • boxplot creates a visual representation of the data, but does not return numeric values. To calculate the relevant summary statistics for the sample data, use the following functions: {In the documentation, the function list follows}
So, to get the median of the first box in a particular plot, do something like this:
Data = randn(100, 10);
Median_1 = median(Data(:,1));
figure(1)
boxplot(Data);
grid