필터 지우기
필터 지우기

Plotting multiple boxplots in one figure from cell array

조회 수: 3 (최근 30일)
Ciaran
Ciaran 2015년 8월 15일
편집: Ciaran 2015년 8월 15일
I'm trying to plot some boxplots on the same figure.
My Code
d={12.9089000000000,'GA';13.3697000000000,'GA';13.4335000000000,'SA';13.5302000000000,'SA';13.8434000000000,'EP';14.2583000000000,'EP'} %snipped of data
%Create groups
EP=[];
GA=[];
PS=[];
SA=[];
SS=[];
for i=1:size(d),
if strcmp(d(i,2),'EP'),
EP(i)=cell2mat(d(i,1));
elseif strcmp(d(i,2),'GA'),
GA(i)=cell2mat(d(i));
elseif strcmp(d(i,2),'PS'),
PS(i)=cell2mat(d(i));
elseif strcmp(d(i,2),'SA'),
SA(i)=cell2mat(d(i));
elseif strcmp(d(i,2),'SS'),
SS(i)=cell2mat(d(i));
end
end
%Plot boxplots
figure(1)
x=[EP,GA,PS,SA,SS]
g={'EP','GA','PS','SA','SS'};
boxplot(x,g)
This code however does not work. Could anybody show me how to plot these boxplots on the same figure whilst having the appropriate group name (variable 'g' in the code above) on the x axis?
Thank you

답변 (0개)

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by