Some mods to make work with matlab results, and fixed output bug.

the matlab side is hacky at the moment