M = mahal(obj,X)
M = mahal(obj,X,Name,Value)
returns
the squared Mahalanobis distances from observations in M
= mahal(obj
,X
)X
to
the class means in obj
.
computes
the squared Mahalanobis distance with additional options specified
by one or more M
= mahal(obj
,X
,Name,Value
)Name,Value
pair arguments.

Discriminant analysis classifier of class 

Numeric matrix of size 
Specify optional commaseparated pairs of Name,Value
arguments.
Name
is the argument
name and Value
is the corresponding
value. Name
must appear
inside single quotes (' '
).
You can specify several name and value pair
arguments in any order as Name1,Value1,...,NameN,ValueN
.

Class labels consisting of 

Size and meaning of output

Find the Mahalanobis distances from the mean of the Fisher iris data to the class means, using distinct covariance matrices for each class:
load fisheriris obj = fitcdiscr(meas,species,... 'DiscrimType','quadratic'); mahadist = mahal(obj,mean(meas)) mahadist = 220.0667 5.0254 30.5804