Documentation

Variable-Size Data

Definition and differences for code generation

Blocks

MATLAB Function Include MATLAB code in models that generate embeddable C code
MATLAB System Include System object in model

Functions

coder.varsize Declare variable-size array

Examples and How To

Enable Support for Variable-Size Data

Use the MATLAB Function Block Editor to enable or disable variable-size data support.

Declare Variable-Size Inputs and Outputs

Use the Ports and Data Manager to specify the size and upper bound of variable-size inputs and outputs.

Filter a Variable-Size Signal

Simulate a model that uses a variable-size vector to store the values of a white noise signal.

Specify Variable-Size Data Without Dynamic Memory Allocation

Specify upper bounds for variable-size data.

Define Variable-Size Data for Code Generation

Choose a method for defining variable-size data.

Concepts

What Is Variable-Size Data?

Variable-size data is data whose size can change at run time.

How MATLAB Function Blocks Implement Variable-Size Data

Variable-size data in a MATLAB Function function block must have an upper bound.

Variable-Size Data Definition for Code Generation

Use variable-size data in MATLAB® code intended for code generation.

Variable-Size Data in Code Generation Reports

View variable-size data in code generation reports.

C Code Interface for Arrays

Use the programming interface for statically and dynamically allocated arrays in generated code.

Incompatibilities with MATLAB in Variable-Size Support for Code Generation

In some cases, the results for variable-size data in generated code are different than the results in MATLAB.

Variable-Sizing Restrictions for Code Generation of Toolbox Functions

Some restrictions for variable-size data apply to multiple toolbox functions.

Bounded Versus Unbounded Variable-Size Data

Bounded variable-size data has fixed upper bounds whereas unbounded variable-size data does not.

Troubleshooting

Diagnose and Fix Variable-Size Data Errors

Troubleshoot size mismatch and upper bounds detection errors.

Was this topic helpful?