added write to matlab