Can we generate macro function in code, using simulink model and RTW EC auto coder ?

2 Ansichten (letzte 30 Tage)
We are currently having lot of for loops , and they are just to fetch the data from a constant array in to a local data array We need to optimze that .
Is there any way in Matlab modelling ,
Can we generate a Macro code , instead of regular C code ,using the library block sets in simulink and RTW-EC Auto code generator ?
that will increase the memory consumption , but my execution can be improved !!

Antworten (1)

Kaustubha Govind
Kaustubha Govind am 3 Mai 2013
The closest thing that I can think of is to increase the Loop unrolling threshold on the Configuration Parameter window's Optimization Pane, so the indexing code is inlined, instead of using for-loops. I'm not sure if this is what you intend when you say "macro code".
  1 Kommentar
Ajay Pherwani
Ajay Pherwani am 5 Mai 2013
Thanks for the answer .
1) using "Optimization Pane" will be helpful if i had an fixed size array But we are rolling this for loop over the size of array ( which can vary )
hence my code cannot have to be a fixed inline assignment .
2)Yes when I say "Macro code" its something like " #define " in C coding
At the time of compilation( hex file generation - that we put in our controller) these particular part of codes are optimized( Inlined ) by compiler
--> This will be helpful in the case of varying size of array .. that inlining which we are think of achieveing in matlab code gen , will be take care during the compilation process .
Let me know your thoughts

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by