How can I get and set variables like PID parameters in a Simulink model from an mfile?

조회 수: 3 (최근 30일)
I want to carry simulink variable (eg. PID parameters)to mfile. After I process in mfile, I will send to simulink model. How can I do this. Could you suggest any way for me?
  댓글 수: 3
Recep
Recep 2011년 2월 15일
No. Once model run (example: 0-5 second) and end of the 5 second model simulation stop. After that, I send the variables to mfile, m file run, I send variables to simulink. This loop will continue until loop will be end.
James Allison
James Allison 2011년 2월 16일
You have several options:
1) use get_param to obtain Simulink model parameters, and use set_param to set them
2) Use variables in your Simulink model parameters, and define them in the base workspace. You can set these values using your m file, and then run the Simulink model.
3) If you run your Simulink model using the sim command, you can pass in model parameter values.

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

답변 (3개)

Paulo Silva
Paulo Silva 2011년 2월 14일
doc open_system
doc load_system
doc set_param
doc sim
doc save_system
doc close_system

Todd Flanagan
Todd Flanagan 2011년 2월 14일

Kaustubha Govind
Kaustubha Govind 2011년 2월 15일
You can log data from Simulink using the To Workspace block and import data back into the model using the From Workspace block.

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by