function L = elinkage(y, alpha) %ELINKAGE Minimum energy clustering for Matlab % % y data matrix with observations in rows, % or distances produced by pdist % alpha power of Euclidean distance, 0 L(merges, 2); ij = L(merges, 1); L(merges, 1) = L(merges, 2); L(merges, 2) = ij; end; end; %handle the final merge L(n-1, :) = [clindex(1), clindex(2), ed(1, 2)]; if L(n-1, 1) > L(n-1, 2); ij = L(n-1, 1); L(n-1, 1) = L(n-1, 2); L(n-1, 2) = ij; end;