When integrating compiled MATLAB® functions into a Python® application, your code must initialize the MATLAB Runtime:
Optionally, provide a list of startup options to the MATLAB Runtime using
the initialize_runtime()
function.
Start the MATLAB Runtime, and load a MATLAB Runtime instance
using the initialize()
function of each compiled
package used in the application.
Note:
On Mac OS X, you must pass the MATLAB Runtime options
to the |
The MATLAB Runtime has two startup options that you can specify:
-nojvm
— disable the Java® Virtual
Machine, which is enabled by default. This can help improve the MATLAB Runtime performance.
-nodisplay
— on Linux®,
run the MATLAB Runtime without display functionality.
You specify these options before you initialize the compiled MATLAB functions.
You do so by calling the initialize_runtime()
method
of a generated Python package with the MATLAB Runtime options.
The list of MATLAB Runtime options is passed as a list of strings.
For example, to start the MATLAB Runtime for the package addmatrix
with
no display and no Java Virtual Machine:
import addmatrix addmatrix.initialize_runtime(['-nojvm', '-nodisplay'])
If your application uses multiple Python packages, you
call initialize_runtime()
from only one package.
The first call sets the run-time options for the MATLAB Runtime session.
Any subsequent calls are ignored.
To evaluate a compiled MATLAB function, load it into the MATLAB Runtime.
Do this by calling the initialize()
method of the
generated Python package. The initialize()
method
returns an object that can be used to evaluate the compiled MATLAB functions
in the package. For example, to start the MATLAB Runtime and load
the MATLAB functions in the addmatrix
package,
use:
import addmatrix myAdder = addmatrix.initialize()
Note:
If the |