How I can run a simulink model from Python script?

조회 수: 79 (최근 30일)
Alessandra Cuneo
Alessandra Cuneo 2016년 9월 21일
댓글: David 2023년 1월 19일
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
sonali umare
sonali umare 2020년 2월 6일
how can I import IEEE distribution system of MATLAB in python
Meng Zhang
Meng Zhang 2021년 12월 1일
how to run the simulnk model just for one step by using MATLAB Engine API?

댓글을 달려면 로그인하십시오.

채택된 답변

Bo Li
Bo Li 2016년 9월 22일
You may consider MATLAB Engine API for Python:
For example:
>>>import matlab.engine
>>>eng = matlab.engine.start_matlab()
>>>eng.sim("vdp")
  댓글 수: 5
Wade
Wade 2018년 4월 9일
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
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?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Meng Zhang
Meng Zhang 2021년 12월 1일
how to run the simulnk model just for one step by using MATLAB Engine API?

카테고리

Help CenterFile Exchange에서 Call MATLAB from Python에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by