update matlab function