Updated Matlab functions