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

4 次查看(过去 30 天)
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 !!

回答(1 个)

Kaustubha Govind
Kaustubha Govind 2013-5-3
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 个评论
Ajay Pherwani
Ajay Pherwani 2013-5-5
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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by