I am not familiar with MATLAB at all. However if you know how to run a MATLAB script from a command line, you can run a command line from Python using the Calculate Value tool.
python - Executing a subprocess fails - Stack Overflow
UPDATE the above example has some good suggestions but is very dated. Updated below, based on the current Python docs:
17.1. subprocess — Subprocess management — Python 2.7.13 documentation
For example
Expression
run_script()
Code Block
import subprocess
from subprocess import STDOUT
def run_script():
params = [r"path_to_matlab.exe",
"param1",
"param2"]
msg = subprocess.check_output(params, stdout=STDOUT)
return msg
Here's a bonehead example of running and command line to get a folder list from cmd.exe.
In the example, the model element Folder is of type Folder, created with right click, Create Variable.
Expression
run_cmd(r"%Folder%")
Code Block
import subprocess
def run_cmd(f):
params = ["cmd.exe", "/c", "dir {}".format(f)]
msg = subprocess.check_output(params, cwd=f, stderr=subprocess.STDOUT)
return msg
When this is run in Model Builder, I get this:
Executing (Calculate Value): CalculateValue run_cmd(r"C:\Users\cprice\Documents\ArcGIS") "import subprocess\ndef run_cmd(f):\n params = ["cmd.exe", "/c", "dir {}".format(f)]\n msg = subprocess.check_output(params, cwd=f, stderr=subprocess.STDOUT)\n return msg" Variant
Start Time: Wed May 24 15:29:16 2017
Value = Volume in drive C has no label.
Volume Serial Number is XXXX-XXXX
Directory of C:\Users\cprice\Documents\ArcGIS
05/05/2017 11:07 AM <DIR> .
05/05/2017 11:07 AM <DIR> ..
11/18/2016 03:03 PM <DIR> AddIns
03/03/2017 09:55 PM 1,123 arcpy_raster.py
(...)
38 File(s) 949,426,908 bytes
23 Dir(s) 23,970,992,128 bytes free
Succeeded at Wed May 24 15:29:16 2017 (Elapsed Time: 0.11 seconds)