Mahalanobis distance matrix of an excel dataset

5 views (last 30 days)
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.

Accepted Answer

Akira Agata
Akira Agata on 27 Feb 2019
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
Mmotevasseli(alex)
Mmotevasseli(alex) on 27 Feb 2019
what should i do if i want use formula of mahalanobis in my code and dont use pdist?
Akira Agata
Akira Agata on 3 Mar 2019
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.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!