m = margin(mdl,X,Y)
returns
the classification margins for the matrix of predictors m
= margin(mdl
,X
,Y
)X
and
class labels Y
. For the definition, see Margin.

Numeric column vector of length 
The classification margin is the difference between the classification score for the true class and maximal classification score for the false classes.
The score of a classification is the posterior probability of the classification. The posterior probability is the number of neighbors that have that classification, divided by the number of neighbors. For a more detailed definition that includes weights and prior probabilities, see Posterior Probability.