This project is a component of the Simbind tool and includes a primary function:
# simulink_exporter/utils.py
def export_model(
slx_path: str,
output_dir: str,
step_size: float,
solver: FixedStepSolver
):
...
The export_model function leverages matlabengine to build a specified .slx model using a defined solver and fixed time step. It then outputs .c and .h files to the specified directory.
The only dependency you will see in requirements.txt is matlabengine, but be aware matlabengine is very cranky and will reject to be installed if you don't have Matlab installed, or if there is missmatch between matlabengine version and Matlab release, or if there is missmatch between matlabengine and Python versions. With specified matlabengine==9.15.2 you need:
- Matlab release R2023b or older.
- Python 3.9, 3.10 or 3.11.
To find matlabengine version that fits you need you can refer to Release history.
You also need Simulink suite with Embedded Coder, since project uses 'ert.tlc' target.