Matlab integration improvement