coder.inline
Control inlining of a specific function in generated code
Description
coder.inline('always')
forcesinliningof the current function in the generated code. Place thecoder.inline
directive inside the function that you want to inline. The code generator does not inline entry-point functions and recursive functions. Also, the code generator does not inline functions intoparfor
loops, or inline functions called fromparfor
loops.
coder.inline('never')
prevents inlining of the current function in the generated code. Prevent inlining when you want to simplify the mapping between the MATLAB®source code and the generated code.
Note
If you use thecodegen
(MATLAB Coder)or thefiaccel
(Fixed-Point Designer)command, you can disable inlining for all functions by using the- o禁用:内联
option.
If you generate C/C++ code by using thecodegen
command or theMATLAB Coder™app, you might have different speed and readability requirements for the code generated for functions that you write and the code generated for MathWorks®功能。某些额外的全局设置enable you to separately control the inlining behavior for these two parts of the generated code base and at the boundary between them. See .
coder.inline('default')
instructs the code generator to use internal heuristics to determine whether to inline the current function. Usually, the heuristics produce highly optimized code. Usecoder.inline
explicitly in your MATLAB functions only when you need to fine-tune these optimizations.