Main Content

Algorithm Design Basics

Algorithm design considerations for code generation, behavior of generated code


coder.allowpcodeControl code generation from protected MATLAB files
coder.cevalCall external C/C++ function
coder.cincludeInclude header file in generated code
coder.cstructnameName C structure type in generated code
coder.extrinsicDeclare a function as extrinsic and execute it in MATLAB
coder.inlineControl inlining of a specific function in generated code
coder.loadLoad compile-time constants from MAT-file or ASCII file into caller workspace
coder.nullcopyDeclare uninitialized variables in code generation
coder.opaqueDeclare variable in generated code
coder.refIndicate data to pass by reference
coder.screenerDetermine if function is suitable for code generation
coder.rrefIndicate read-only data to pass by reference
coder.targetDetermine if code generation target is specified target
coder.unrollUnroll for-loop by making a copy of the loop body for each loop iteration
coder.varsizeDeclare variable-size data
coder.wrefIndicate write-only data to pass by reference
coder.updateBuildInfoUpdate build information object RTW.BuildInfo


coder.ExternalDependencyInterface to external code
coder.BuildConfigBuild 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.


When to Generate Code from MATLAB Algorithms

Decide whether to generate code for your application.

Which Code Generation Feature to Use

Choose code generation feature for your application.

Prerequisites for C/C++ Code Generation from MATLAB

Code generation from MATLAB® code requires the MATLAB Coder™ product and a C/C++ compiler.

Differences Between Generated Code and MATLAB Code

Generated C/C++ code can behave differently than original MATLAB source code.

Code Generation Readiness Tool

Interpret code generation readiness tool report.

MATLAB Language Features Supported for C/C++ Code Generation

Use the MATLAB language features and functions that code generation supports.

MATLAB Code Design Considerations for Code Generation

When writing MATLAB for code generation, consider design constraints.


Unknown Output Type for coder.ceval

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