MATLAB Answers

0

Mahalanobis distance matrix of an excel dataset

Asked by Mmotevasseli(alex) on 26 Feb 2019
Latest activity Commented on by Akira Agata
on 3 Mar 2019
i have an excel dataset with 7 column and 20 rows . i want to know how to compute and get the mahalanobis distance matrix in matlab.

  0 Comments

Sign in to comment.

1 Answer

Answer by Akira Agata
on 27 Feb 2019
 Accepted Answer

Like this?
% Read data from Excel file
Data = xlsread('yourExcelFile.xlsx');
% Calculate pair-wise mahalanobis distance
D = pdist(Data,'mahalanobis');
% Convert to square form
D = squareform(D);

  2 Comments

what should i do if i want use formula of mahalanobis in my code and dont use pdist?
In that case, maybe you have to implement mahalanobis-based pdist function by yourself using basic MATLAB function...
The definition of mahalanobis distance used in pdist function can be found in the pdist help page:

Sign in to comment.