How to programmatically add a block from Audio Toolbox to Simulink?

2 ビュー (過去 30 日間)
Danijel Domazet
Danijel Domazet 2020 年 5 月 22 日
コメント済み: Danijel Domazet 2020 年 5 月 26 日
I have added a Simulink "In File" block programmatically:
add_block('simulink/Sinks/To File',...)
How do I add a block from Audio Toolbox?
I tried
add_block('Audio Toolbox/Sources/From Multimedia File',..)
but it fails with "There is no block named 'Audio Toolbox/Sources/From Multimedia File'".

採用された回答

Cristian Garcia Milan
Cristian Garcia Milan 2020 年 5 月 22 日
Hi,
In order to add a block you shouldn't look at the library name because its file could be named differently. This is that case.
You should point:
'dspvision/From Multimedia File'
If you want to add any block, you can check its real source by selecting it and in the command window executing
get_param(gcbh,'ReferenceBlock')
Except if the block comes from built-in, in that case you should look at the
'BlockType'
property.
Hope it helps.
  6 件のコメント
Cristian Garcia Milan
Cristian Garcia Milan 2020 年 5 月 25 日
You should use get(gcbh) while you have the block that you want. You will see all its properties as simulink block. At the end, there are some parameters that you can modify. At the left you will see the property name, and at the right its value. Using
set_param(path_of_the_block,property_name,property_value)
Danijel Domazet
Danijel Domazet 2020 年 5 月 26 日
This works, thanks.
Just selecting a block in Simulink, then go back to MATLAB command line and execute:
get(gcbh)
This gives all the info about the block, including parameter names.
Nor sure why is this info not documented.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio Processing Algorithm Design についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by