MATLAB® function help text
R2026bMATLAB function help text in generated function banner
Description
App Configuration Pane: Code Appearance
Configuration Objects: coder.EmbeddedCodeConfig
The MATLAB function help text parameter specifies whether to include the MATLAB function help text in the banner of the generated C/C++ function.
If this parameter is disabled, the code generator treats the MATLAB function help text as a regular code comment. To learn about how MATLAB code comments appear in the generated code, see Include comments.
If a certain MATLAB function is inlined in the generated code, the code generator treats the help text for this function as a regular code comment regardless of whether the MATLAB function help text parameter is enabled.
Dependencies
To enable this parameter, select the Include comments check box.
Settings
- On
This value is the default value.
The code generator includes MATLAB function help text in the function banner in the generated code.
- Off
The code generator treats the help text as a user comment.
Programmatic Use
Property:
MATLABFcnDesc |
Values: true |
false |
Default: true |
Examples
Place MATLAB Function Help Text in Generated Function Banner
Define an entry-point function fractionalPart that
calls another function mySubtract.
function y = fractionalPart(a) %FRACTIONALPART This function calculates the fractional part of a number. % This function has one input and one output. b = floor(a); % Here this function calls the mySubtract function. y = mySubtract(a,b); end
In a separate file, define the function
mySubtract.
function y = mySubtract(a,b) %MYSUBTRACT This function subtracts one number from another. % This function has two inputs and one output. y = a - b; end
Generate code for the fractionalPart function. Specify
the input to be a scalar double.
codegen -config:lib -c fractionalPart -args 0 -report
Open the code generation report and inspect the generated
fractionalPart function. The help text of the
corresponding MATLAB function appears in the generated function banner. However,
the code generator has inlined the mySubtract function
into the body of the caller. Therefore, the mySubtract
help text appears as a regular comment in the generated code.
/*
* FRACTIONALPART This function calculates the fractional part of a number.
* This function has one input and one output.
*
* Arguments : double a
* Return Type : double
*/
double fractionalPart(double a)
{
/* Here this function calls the mySubtract function. */
/* MYSUBTRACT This function subtracts one number from another. */
/* This function has two inputs and one output. */
return a - floor(a);
}To prevent inlining of the mySubtract function call,
add the coder.inline("never") directive in the body of
mySubtract.
function y = mySubtract(a,b) %MYSUBTRACT This function subtracts one number from another. % This function has two inputs and one output. coder.inline("never") y = a - b; end
Now generate code for the fractionalPart function and
inspect the generated files. Both help texts now appear as function banners
in the generated code.
/*
* FRACTIONALPART This function calculates the fractional part of a number.
* This function has one input and one output.
*
* Arguments : double a
* Return Type : double
*/
double fractionalPart(double a)
{
/* Here this function calls the mySubtract function. */
return mySubtract(a, floor(a));
}
/*
* MYSUBTRACT This function subtracts one number from another.
* This function has two inputs and one output.
*
* Arguments : double a
* double b
* Return Type : double
*/
double mySubtract(double a, double b)
{
return a - b;
}Place MATLAB Function Help Text in Generated Code Comment
Create a configuration object and set the MATLABFcnDesc
property to false. Use this configuration object when
generating code for the fractionalPart function that you
defined in the preceding example.
cfg = coder.config("lib"); cfg.MATLABFcnDesc = false; codegen -config cfg -c fractionalPart -args 0 -report
Open the code generation report and inspect the generated
fractionalPart function. Observe that the help text
appears as regular comment lines in the generated code.
double fractionalPart(double a)
{
/* FRACTIONALPART This function calculates the fractional part of a number. */
/* This function has one input and one output. */
/* Here this function calls the mySubtract function. */
return mySubtract(a, floor(a));
}Version History
Introduced in R2011a