Passing data by reference to Matlab toolbox functions for code generation

조회 수: 4 (최근 30일)
Jakub Jon
Jakub Jon 2021년 10월 14일
답변: Harsh 2025년 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.

답변 (1개)

Harsh
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

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by