unable to get_param signal name , error in using for loop
1 回表示 (過去 30 日間)
古いコメントを表示
Dharaneedharan Arumugam
2021 年 1 月 1 日
コメント済み: Dharaneedharan Arumugam
2021 年 3 月 25 日
can anyone find the solution for this code?
i am unable to run this code with for loop. if i run only the first line in the loop there is no issue.
const_blocks = find_system(gcs,'Searchdepth','1','BlockType','Constant')
for i=1:1:length(const_blocks)
{
const_value{1,1} = get_param(const_blocks{i,1},'Value');
const_block_handle = get_param(const_blocks{i,1},'Porthandles');
set_param(const_block_handle.Outport(1),'Name',const_value{1,1});
}
1 件のコメント
riccardo
2021 年 1 月 4 日
apologies, what do you mean by "unable to run" ?
if you have a run-tim exception, the error message should help you.
採用された回答
Fangjun Jiang
2021 年 1 月 4 日
Your code is correct, except that
- No "end" statement for the for-loop
- Remove the "{" and "}" lines (meant to enclose the for-loop code?). That is for C code, not for MATLAB code.
Also, make sure all the "value" for the Constant block are variable names, not numerical constant values.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Simulink Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!