Read xls file to create simulink blocks

5 次查看(过去 30 天)
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

采纳的回答

Dilip Rao
Dilip Rao 2011-11-21
The Model building method described here
integrated with xlsread command in a Matlab script might work.
Dilip

更多回答(1 个)

Titus Edelhofer
Titus Edelhofer 2011-11-21
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 个评论
Titus Edelhofer
Titus Edelhofer 2011-11-21
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
Dilip Rao 2011-11-21
Hi Titus,
Yeah a script in Matlab that reads the xls file and adds blocks.
Dilip

请先登录,再进行评论。

类别

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