Passing data by reference to Matlab toolbox functions for code generation
1 次查看(过去 30 天)
显示 更早的评论
Hello everyone.
I am working on optimization of generated code. My algorithm uses toolbox function interp1 for linear interpolation. Code for it is generated by Matlab embedded coder. I want to prevent copying of input arrays to it. Normally function doesn't define input argument as in/out, but algorithm doesn't use them afterwards and copy is redundant. Is there a way to tell Matlab coder about it to do optimization.
0 个评论
回答(1 个)
Harsh
2025-1-30
Hi Jakub,
You can use the same variable as both an input and an output. This avoids the parameter being passed by value in the generated code. For more information regarding this practice please check the following documentation - https://www.mathworks.com/help/coder/ug/eliminate-redundant-copies-of-function-inputs.html
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!