1

以下の関数を使用して、データから相関列を見つけて削除しようとしています

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

% it should not contain both 6 4; and 4 6; how do I remove all such rows?

end

64の両方を含めることはできません。および46; そのような行をすべて削除するにはどうすればよいですか?

4

1 に答える 1

4
uniqueA = unique(sort(A,2), 'rows');
于 2012-05-26T22:39:45.900 に答える