Before describing my question I provided the following code, which help me in describing what I'm trying to do:
clear allAirT = {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});endFieldName = {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?
Best Answer