Reproduce several matlab "run" behavior