boxplot of correlation values from a cell array
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Before describing my question I provided the following code, which help me in describing what I'm trying to do:
clear all
AirT = {rand(32,1),rand(32,1),rand(32,1),rand(32,1)};
SolRad = {rand(32,1),rand(32,1),rand(32,1),rand(32,1)};
Rain = {rand(32,1),rand(32,1),rand(32,1),rand(32,1)};
Location = {'England','Wales','Scotland','Ireland'};
points = {1,2,2,2};
CorrVariables = {'AirT','SolRad','Rain'};
for i = 1:length(Location);
Data = @(location) struct('Location',location,CorrVariables{1},AirT{i},...
CorrVariables{2},SolRad{i},CorrVariables{3},Rain{i});
D(i) = Data(Location{i});
end
FieldName = {D.Location};
R = corrcoef([D.AirT],'rows','pairwise');
R_Value = [Location(nchoosek(1:size(R,1),2)) num2cell(nonzeros(tril(R,-1)))];
q = points(nchoosek(1:size(R,1),2));
%to calculate the combination of these points we need to convert the
%cell into a matrix.
qq = cell2mat(q);
%calculate
qq = qq(:,1)+qq(:,2);
%insert into R_Values in the last row.
Re = [R_Value num2cell(qq)];
The code above is not really important but the output provides a better explanation than what I can give.
So, in 'Re' we have the name of the pairs (Re(:,1:2)) of data used in calculating the correlation coefficient (Re(:,3)) and then the combination of the points assigned to each pair (Re(:,4)).
From this I hope to produce a boxplot which shows the correlation values of those pairs with points = 3 in one box and another box showing the correlation values of the pairs with points = 4.
How would I go about doing this?
0 commentaires
Réponse acceptée
the cyclist
le 10 Mar 2012
boxplot(cell2mat(Re(:,3)),Re(:,4))
This first input argument is the data, and the second input argument is the "grouping variable" that indicates the data categories.
See
doc boxplot
for details.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Distribution Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!