How I can run a simulink model from Python script?

80 visualizaciones (últimos 30 días)
Alessandra Cuneo
Alessandra Cuneo el 21 de Sept. de 2016
Comentada: David el 19 de En. de 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?
Thanks
  2 comentarios
sonali umare
sonali umare el 6 de Feb. de 2020
how can I import IEEE distribution system of MATLAB in python
Meng Zhang
Meng Zhang el 1 de Dic. de 2021
how to run the simulnk model just for one step by using MATLAB Engine API?

Iniciar sesión para comentar.

Respuesta aceptada

Bo Li
Bo Li el 22 de Sept. de 2016
You may consider MATLAB Engine API for Python:
For example:
>>>import matlab.engine
>>>eng = matlab.engine.start_matlab()
>>>eng.sim("vdp")
  5 comentarios
Wade
Wade el 9 de Abr. de 2018
I did it in this way:
>> import matlab.engine
>> Matlab = matlab.engine.start_matlab('-desktop')
>> h = Matlab.new_system('NewModelName')
>> s = Matlab.add_block('simulink/Sources/From Workspace',NewModelName+'/DataIn')
>>Matlab.set_param(NewModelName+'/DataIn','Position',matlab.double([150,150,250,250]),nargout=0)
Indhu Priyadharshini Govindasamy
Indhu Priyadharshini Govindasamy el 13 de En. de 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?

Iniciar sesión para comentar.

Más respuestas (1)

Meng Zhang
Meng Zhang el 1 de Dic. de 2021
how to run the simulnk model just for one step by using MATLAB Engine API?

Categorías

Más información sobre Call MATLAB from Python en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by