MatlabEngine

class compas.com.MatlabEngine[source]

Bases: object

Communicate with Matlab through the MATLAB engine.

engine

– An instance of the Matlab engine. The Matlab engine exposes Matlab functions as methods.

session_name

str – The name of the current Matlab session.

Notes

For more info, see 1, 2, 3, 4, 5.

References

1

MathWorks, 2017. MATLAB APY for Python. Available at: https://ch.mathworks.com/help/matlab/matlab-engine-for-python.html

2

MathWorks, 2017. Pass Data to MATLAB from Python. Available at: https://ch.mathworks.com/help/matlab/matlab_external/pass-data-to-matlab-from-python.

3

MathWorks, 2017. Use MATLAB Arrays in Python. Available at: https://ch.mathworks.com/help/matlab/matlab_external/use-matlab-arrays-in-python.html

4

MathWorks, 2017. Use MATLAB Engine Workspace in Python. Available at: https://ch.mathworks.com/help/matlab/matlab_external/use-the-matlab-engine-workspace-in-python.html

5

MathWorks, 2017. Call MATLAB Functions from Python. Available at: https://ch.mathworks.com/help/matlab/matlab_external/call-matlab-functions-from-python.html

Examples

>>> matlab = MatlabEngine()
>>> matlab.engine.isprime(37)
True

Methods

__init__()

x.__init__(…) initializes x; see help(type(x)) for signature

connect([name])

Connect to an existing Matlab session, or start a new session if none exists.

start()

Start a new Matlab engine and related session.

stop()

Stop the running engine.