This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Code Generation

Guidelines for traceability and improving readability, external code integration


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


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 structure 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 Pass argument by reference
coder.rref Pass argument by reference as read-only input
coder.screener Determine if function is suitable for code generation 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 Pass argument as write-only reference
coder.updateBuildInfo Update build information object RTW.BuildInfo


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 a MATLAB Function block.

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.

Encapsulate Interface to an External C Library

Encapsulate the interface to an external C library with coder.ExternalDependency.

Update Build Information from MATLAB code

Control aspects of the build process after code generation but before compilation.


Code Generation Readiness Tool

Interpret code generation readiness tool report.

MATLAB Function Reports

Generate and interpret MATLAB Function reports.

Encapsulating the Interface to External Code

Encapsulate the interface to external code with coder.ExternalDependency.

Best Practices for Using coder.ExternalDependency

Use coder.ExternalDependency according to best practices.

Was this topic helpful?