MATLAB: How to assign lables of box plot

data acquisitionData Acquisition ToolboxMATLABStatistics and Machine Learning Toolbox

Hi,
I have below data:
A B C 1 3 5 12 23 56 12 15 26 18 28 23 19 29 27 25 33 46
I want to get the box plot, and assign each plot name as (A,B,C)
Dataset: 1 3 5 12 23 56 12 15 26 18 28 23 19 29 27 25 33 46
xlabels: {'A' 'B' 'C'}
ylables: {'ObservedData'}
My code: boxplot(dataset) ylabel('ylables') xlabel('xlables') But, I can get the xlables (as A, B, C)

Best Answer

Try this:
Dataset = [ 1 3 5
12 23 56
12 15 26
18 28 23
19 29 27
25 33 46];
xlabels = {'A' 'B' 'C'};
ylabels = {'Observed Data'};
figure
boxplot(Dataset)
ylabel(ylabels)
set(gca, 'XTickLabel',xlabels)