pdist_threeway.m

来自「应用于MATLAB上的聚类方法」· M 代码 · 共 26 行

M
26
字号
function Y=pdist_threeway(Data)

%  Reference:
%  Evrim Acar, Rasmus Bro, Bonnie Schmidt, New Exploratory Metabonomic
%  Tools, Submitted to Journal of Chemometrics, 2007.
%
%
% Y=pdist_threeway(Data)
% This function computes the frobenius norm of the differences between each
% pair of samples in the object mode of a three-way data
% Input: Data: 3-way array
% Output:   Y: Distances as returned by pdist ( not a distance matrix)
%
%
% Last modified: 05/21/2007

N=size(Data,1);
for i=1:N
    for j=(i+1):N
        DistMatrix(i,j)=norm(squeeze(Data(i,:,:)-Data(j,:,:)),'fro');
        Y((i-1)*(N-i/2)+j-i)=DistMatrix(i,j);        
    end
end


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?