Fix bug in Matlab code (RAW file was being written column-by-colymn). Some more candy functionality