我正试图从数据中找到相关的列, 并删除相关的列, 其函数如下 :
function [ correlated ] = correlated( data, threshold )
% data is m x m matrix
% threshold is correlation threshold
c=corr(data);
[i,j] = find(c>threshold);
A = [i,j];
A=A(find(arrayfun(@(i)length(unique(A(i,:))),1:size(A,1))==size(A,2)),:);
% as A also includes 1 1; 2 2; 3 3; etc so I used above line that I found somewhere
% 6 4
% 8 4
% 4 6
% 8 6
% 4 8
% 6 8
% 14 11
% 11 14
% 它不应包含6 4 和4 6;我如何去掉所有这些排?
end
它不应包含6 4 和4 6;我如何去掉所有这些排?