Minimum distance classifier Matlab implementation