Is it possible to read data from .dat or .m file for an intial value of IC block in simulink?

조회 수: 2 (최근 30일)
I have a simulink model with 25 inputs, but I need to assign values to my IC blocks. One way of doing this is to enter them manually. Is it possible to read data from .dat or .m file to assign it to IC blocks?

채택된 답변

Srinivas
Srinivas 2012년 7월 10일
you can assign 25 variables with the values, save them to a mat file and load it before the simulation.

추가 답변 (1개)

K E
K E 2012년 7월 10일
Or you can write a mfile script to read in the stored values from a mat file (or just write them into the mfile), use the set_param command to assign those values to your model, then run the simulations from the script using the sim command. You can further process or save the output from your simulations from within the mfile. This is a useful approach for parameter studies where you are varying those inputs' values.
  댓글 수: 2
Sandeep
Sandeep 2012년 7월 10일
Thanks. I am using a rtw to generate a .dll file. If I use the approach suggested by you, then everytime I make any changes to my initial parameters, I will have to generate a new .dll file.
K E
K E 2012년 7월 10일
Sorry, I forgot you are doing things in real time. You can implement Srinivas's suggestion using a model callback.

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

카테고리

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