for loop in C code used in S-function block slows down Simulink model
Afficher commentaires plus anciens
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?
Réponses (0)
Catégories
En savoir plus sur Simulink Coder dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!