KSH

convert data to mat; calculate the purity.