Skip to content

Instantly share code, notes, and snippets.

View benfulcher's full-sized avatar

Ben Fulcher benfulcher

View GitHub Profile
benfulcher / clusterReorderRows.m
Created July 24, 2019 00:39
Reorder rows of a matrix by hierarchical average linkage clustering on Euclidean distances
function [dataMatrixClustered,dataMatrixNorm] = clusterReorderRows(dataMatrix)
distanceMetric = 'Euclidean';
linkageMethod = 'average';
% Normalize columns:
dataMatrixNorm = zscore(dataMatrix);
% Pairwise distances:
R = pdist(dataMatrix,distanceMetric);