本页对应的英文页面已更新,但尚未翻译。 若要查看最新内容,请点击此处访问英文页面。

数据定义基础知识

如何为代码生成定义数据、变量和函数

模块

MATLAB FunctionMATLAB 代码包含在生成可嵌入式 C 代码的模型中
MATLAB System在模型中包含 System object

示例和操作指南

Reuse the Same Variable with Different Properties

Reuse a variable with different properties when the code generator can determine the properties of each occurrence of the variable.

Eliminate Redundant Copies of Variables in Generated Code

Use coder.nullcopy to indicate that the code generator can allocate memory without initializing it.

全局共享数据

MATLAB Function 模块使用全局数据。

Initialize Persistent Variables in MATLAB Functions

Specialized semantics impact the way that a function initializes persistent data.

概念

Data Definition for Code Generation

Define data in MATLAB® code intended for code generation.

Variables Definition for Code Generation

Define the class, size, and complexity of variables in MATLAB source code before using them.

为 C/C++ 代码生成定义变量的最佳做法

遵循在用于代码生成的 MATLAB 代码中定义变量的规范。

Supported Variable Types

Use data types that code generation supports.

Reassignment of Variable Properties

Reassign a variable with a value of different class, size, or complexity.

Code Generation for Complex Data

Use complex data in MATLAB code intended for code generation.

Code Generation for Sparse Matrices

Use sparse matrices in MATLAB code intended for code generation.

Code Generation for Constants in Structures and Arrays

Sometimes the code generator does not recognize constant structure fields or array elements.

Array Size Restrictions for Code Generation

The code generator and the target hardware constrain the maximum number of elements of an array.