adding "Rate_Transition" block via Add_Block() error

1 回表示 (過去 30 日間)
SSOI SS
SSOI SS 2012 年 1 月 4 日
Hi, I tried several time with follwing lines to add a simulink "Rate Transition" block via script, why do I always get an error?
try
add_block('built-in/Rate Transition', ...
'rplg_CL/Rate Transition', ...
'Position',[650,midd-20,750,midd+20]);
catch
add_block('simulink/Signal Attributes/Rate Transition', ...
'rplg_CL/Rate Transition', ...
'Position',[650,midd-20,750,midd+20]);
end
Error is:
There is no block named 'simulink/Signal Attributes/Rate Transition'
Any idea? BTW, how can I know which name of the block I should use to add a block?

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2012 年 1 月 4 日
Use add_block('built-in/RateTransition', ...) without the white space.
This could be improved on the TMW side. If you look at doc add_block, it says:
You can use 'built-in/blocktype' as a source block path for Simulink built-in blocks (blocks available in Simulink block libraries that are not masked blocks), where blocktype is the built-in block's type, i.e., the value of its BlockType parameter.
The 'BlockType' property of that block is 'RateTransition', not 'Rate Transition'.
To use 'simulink/Signal Attributes/Rate Transition', you have to use char(10) to replace the white space in 'Signal Attributes'. This is another place that needs to be improved on the TMW side, in my opinion.

カテゴリ

Help Center および File ExchangeVerification, Validation, and Test についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by