Is it possible to read data from .dat or .m file for an intial value of IC block in simulink?
1 回表示 (過去 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?
0 件のコメント
採用された回答
Srinivas
2012 年 7 月 10 日
you can assign 25 variables with the values, save them to a mat file and load it before the simulation.
0 件のコメント
その他の回答 (1 件)
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 件のコメント
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 Center および File Exchange で Programmatic Model Editing についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!