fix bug for csv file header by adding a sorted array of all distinct
categories found. see output/matrix.csv