Some changes to send data to Matlab