Plotting multiple boxplots in one figure from cell array
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!