code to read a csv file and bugfix on spurious whitespace at the end of each line when printing matrices