problem with automized add_block destinations
이전 댓글 표시
hello,
I am using the add_block function to automatize the creation of a model in simulink. I have stored the block names in a column of a table data, i would like to add the blocks and automatically change their names according to the string data of the table. Here is the code:
nL = numel(data.X)
for i=1:nl
h=add_block('MyLibrary/BlockName' , ['MyModel/',data.Names(i)])
end
here is the error message:
"Invalid destination block specification."
data.Names is a string column of the table data. I have tried using another column of the table
for i=1:nl
h=add_block('MyLibrary/BlockName' , ['MyModel/',num2str(data.X(i))])
end
and this works perfectly! What i am missing? please help! Thank you all!
댓글 수: 4
Ameer Hamza
2020년 5월 8일
편집: Ameer Hamza
2020년 5월 8일
Can you paste the output of
data.Names(1)
Davide Maglione
2020년 5월 8일
Sulaymon Eshkabilov
2020년 5월 8일
you are accessing to your stored created block names in strings via their index numbers. That is it.
Davide Maglione
2020년 5월 8일
채택된 답변
추가 답변 (1개)
Sulaymon Eshkabilov
2020년 5월 8일
0 개 추천
you are accessing to your stored created block names in strings via their index numbers. That is it.
카테고리
도움말 센터 및 File Exchange에서 String에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!