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에서 Simulink Coder에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!