[data] [data, distances] [data, distances, indexes] = data_sort_distance(data, mode, s2=mean wavenumber variance) sorts data in ascending order to mean spectrum Inputs: - mode: 'euclidean', 'mahalanobis', 'density' Outputs: - data: sorted dataset - distances: distances from the mean spectrum in the sorted dataset - indexes: indexes of the new spectra in respect to the old/unsorted dataset