File Exchange

image thumbnail

MultiClass LDA

version (2.83 KB) by Darko Juric
Performs multiclass linear discriminant analysis.


Updated 05 Jul 2011

View Version History

View License

- Allows for >=2 classes
- Requires only base MATLAB (no toolboxes needed)
- Assumes that the data is complete (no missing values)
- Has been verified against statistical software

- if pooled covariance could not be calculated matrix values will be ("Inf")
(no error)

-requires Matlab >=7.6 (OOP synatx)

Cite As

Darko Juric (2021). MultiClass LDA (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (6)


When run the code. it said:

Undefined function 'knnclassify' for input arguments of type 'cell'.

Error in LDA_Demo (line 28)
calculatedClases = knnclassify(transformedTestSamples, transformedTrainSamples, trainClasses);


Jang Bahadur Singh


Hi Darko,
thank you very much for sharing your file!!
But how could I use your code directly in MATLAB?
Do I have to store it in a new function or so?!?
Thanks a lot!

Lester Lim

Darko Juric

Make groups from 'transformedTrainSamples' and specify a group for every sample from 'transformedTestSamples'.
Number of groups and sample belonging are determinated by 'trainClasses'.

I hope it is clearer now.

Kim Xu

What is knnclassfy?

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!