annotate toolboxes/MIRtoolbox1.3.2/MIRToolbox/@mirscalar/corrcoef.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function r = corrcoef(x,y)
wolffd@0 2
wolffd@0 3 dx = get(x,'Data');
wolffd@0 4 dy = get(y,'Data');
wolffd@0 5 fx = get(x,'FramePos');
wolffd@0 6 fy = get(y,'FramePos');
wolffd@0 7 dr = cell(1,length(fx));
wolffd@0 8 for h = 1:length(fx)
wolffd@0 9 dr{h} = cell(1,length(fx{h}));
wolffd@0 10 for i = 1:length(fx{h})
wolffd@0 11 [f,ix,iy] = intersect(fx{h}{i}',fy{h}{i}','rows');
wolffd@0 12 dxi = dx{h}{i}(:,ix,:,:);
wolffd@0 13 dyi = dy{h}{i}(:,iy,:,:);
wolffd@0 14 dr{h}{i} = corrcoef(dxi,dyi);
wolffd@0 15 end
wolffd@0 16 end
wolffd@0 17 r = mirmatrix(x,'Data',dr,'Title','Correlation coefficients','Unit','');