How I can run a simulink model from Python script?
226 views (last 30 days)
Show older comments
Alessandra Cuneo on 21 Sep 2016
Commented: David on 19 Jan 2023
Hi, I'm trying to write a script in Python that generate number of inputs, and use them as inputs in a Simulink model. My doubt is how to run a Simulink model from Python (I'm working in windows). Could someone help me?
Bo Li on 22 Sep 2016
You may consider MATLAB Engine API for Python:
>>>eng = matlab.engine.start_matlab()
Indhu Priyadharshini Govindasamy on 13 Jan 2022
I tried in python like you commented before .it is working completely fine but
i want to run the simulink model in C code and Engine Api
I could find any reference for that.Could you please help me?
More Answers (1)
how to run the simulnk model just for one step by using MATLAB Engine API?
David on 19 Jan 2023
Here is an example on how to do this: https://medium.com/@soutrikbandyopadhyay/controlling-a-simulink-model-by-a-python-controller-2b67bde744ee
Find more on Call MATLAB from Python in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!