A new block named 'data1' cannot be added

I am using for loop to create workspace variable block and conveter block and connect it.
While reaching at add block it gives error A new block named 'data1' cannot be added.
data =__ % defined in column
sys='testModel';
add_block('built-in/FromWorkspace',[sys, char(data(i))],'Position',pos1);

回答 (2 件)

Fangjun Jiang
Fangjun Jiang 2022 年 2 月 14 日

0 投票

Most likely it is because a block with the same name already exists. Use the 'MakeNameUnique', 'on' option.
[sys, char(data(i))] is probably not right. Don't you want 'testModel/Data1' with the '/' seperator?
Vineela
Vineela 2023 年 4 月 22 日

0 投票

'testModel/Data1'

カテゴリ

ヘルプ センター および File ExchangeEvent Functions についてさらに検索

製品

リリース

R2017b

タグ

質問済み:

2022 年 2 月 12 日

回答済み:

2023 年 4 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by