Documentation

Code Generation

Guidelines for traceability and improving readability, external code integration

Blocks

MATLAB Function Include MATLAB code in models that generate embeddable C code

Functions

coder.allowpcode Control code generation from protected MATLAB files
coder.ceval Call external C/C++ function
coder.cinclude Include header file in generated code
coder.const Fold expressions into constants in generated code
coder.cstructname Name C structure type in generated code
coder.extrinsic Declare extrinsic function or functions
coder.inline Control inlining in generated code
coder.load Load compile-time constants from MAT-file or ASCII file into caller workspace
coder.opaque Declare variable in generated code
coder.ref Indicate data to pass by reference
coder.rref Indicate read-only data to pass by reference
coder.screener Determine if function is suitable for code generation
coder.target Determine if code generation target is specified target
coder.unroll Unroll for-loop by making a copy of the loop body for each loop iteration
coder.wref Indicate write-only data to pass by reference
coder.updateBuildInfo 构建更新通知ation object RTW.BuildInfo

Classes

coder.ExternalDependency Interface to external code
coder.BuildConfig Build context during code generation

Examples and How To

Check Code Using the Code Generation Readiness Tool

Run the code generation readiness tool at the command line or from the current folder browser.

Use Traceability in MATLAB Function Blocks

Trace between source code and generated code in aMATLAB Functionblock.

Include MATLAB Code as Comments in Generated Code

Correlate generated code with source code.

Enhance Code Readability for MATLAB Function Blocks

Convert if-elseif-else code to switch-case statements.

Concepts

Integrate C Code Using the MATLAB Function Block

Describes how to use MATLAB Function block to call external C code and how to control enumeration and bus typedefs

Code Generation Readiness Tool

Interpret code generation readiness tool report.

MATLAB Function Reports

Generate and interpret MATLAB Function reports.

Troubleshooting

Unknown Output Type for coder.ceval

Define the output type for external C/C++ function calls.

Was this topic helpful?