Gary Stofan
Ansys Employee

There are several examples like this on YouTube search for "Matlab Ansys". 
There was good example titled "Interface MATALB and ANSYS" where MATLAB runs Ansys APDL in batch mode and passes parameter data back/forth via simple text files. 

The concept to understand is that we do not "build" the Ansys analysis via script. The analysis (base APDL input file) is pre-built by the user, and only the desired parameter data is fed into the Analysis by Matlab.