Added Mac support to Matlab script