for loop in C code used in S-function block slows down Simulink model
古いコメントを表示
I have a Simulink model which contains an S-function block which is set up and working fine with C code. However when I try to add a for loop like this for( d = 0; d < N; d++ ) { deltaP[d]=deltaP[d]+(difL/sumspace)*space[d]; } simulink slows down to a snails pace. Is doesn't seem to like using the original value to define the next value when in an array as if I instead were to write for( d = 0; d < N; d++ ) { deltaP[d]=(difL/sumspace)*space[d]; } the problem no longer exists. I could possible not use for loops and just define each value individually e.g deltaP1=(difL/sumspace)*space[1]; deltaP2=(difL/sumspace)*space[2]; etc but this seems long and clunky. Could anyone help with this?
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Discontinuities についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!