matlab.setup_matlab
matlab.setup_matlab
Functions¶
| Name | Description |
|---|---|
| add_matlablatest_path | Add the ‘matlablatest’ path to the MATLAB environment using manage_paths. |
| connect_to_matlab | Connect to an existing shared MATLAB session, or start a new one. |
| setup_util_path | Add the MATLAB utils path to the MATLAB engine’s path, if not already present. |
add_matlablatest_path¶
matlab.setup_matlab.add_matlablatest_path(eng)Add the ‘matlablatest’ path to the MATLAB environment using manage_paths.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| eng | matlab.engine.MatlabEngine | MATLAB engine instance. | required |
Raises¶
| Name | Type | Description |
|---|---|---|
| ValueError | If the MATLAB engine instance is invalid, or no ‘matlabfiles’ paths are found after adding ‘matlablatest’. | |
| RuntimeError | If the ‘manage_paths’ function is not available in MATLAB. |
connect_to_matlab¶
matlab.setup_matlab.connect_to_matlab()Connect to an existing shared MATLAB session, or start a new one.
Make sure to only call this function once per session — a second call
to connect to the same shared engine raises an EngineError.
Returns¶
| Name | Type | Description |
|---|---|---|
| matlab.engine.MatlabEngine | The connected (or newly started) MATLAB engine instance. |
setup_util_path¶
matlab.setup_matlab.setup_util_path(
eng,
matlab_utils_path=os.environ.get('MATLAB_UTILS'),
)Add the MATLAB utils path to the MATLAB engine’s path, if not already present.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| eng | matlab.engine.MatlabEngine | MATLAB engine instance. | required |
| matlab_utils_path | str | None | Path to the MATLAB utils folder. Defaults to the MATLAB_UTILS environment variable. | os.environ.get('MATLAB_UTILS') |