Optimize matlab job code