update matlab code