Read xls file to create simulink blocks
Show older comments
Hello,
I have a xls file with data regarding simulink blocks. Is it possible to create simulink blocks by running a script that reads the xls file? If yes, where can I find the link to the script?
Thank you
Dilip
Accepted Answer
More Answers (1)
Titus Edelhofer
on 21 Nov 2011
0 votes
Hi Dilip,
there are several ways to acchieve this. The simplest would be to write into the preload function of the model (File->Model Properperties-> Callbacks) a call to xlsread reading the data into the workspace. Use those variables in your Simulink blocks.
Titus
3 Comments
Dilip Rao
on 21 Nov 2011
Titus Edelhofer
on 21 Nov 2011
Hi Dilip,
"automatically" means by some script in MATLAB? Using add_block? Then it would be fairly easy: just set the parameters you want to be changed (e.g. "value" for the constant block or "gain" for the gain block) by the values you read from Excel (note, that you need to convert to a string).
Titus
Dilip Rao
on 21 Nov 2011
Categories
Find more on Programmatic Model Editing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!