Updating Matlab code