coder.dataAlignment - Specify data alignment for global or entry-point/exported

function input and output arguments - MATLAB (original) (raw)

Main Content

Specify data alignment for global or entry-point/exported function input and output arguments

Syntax

Description

coder.dataAlignment(['varName'](#bvn0llo-1-varName),[align_value](#bvn0llo-1-align%5Fvalue)) specifies data alignment in MATLABĀ® code for the variable (varName), which is imported data or global (exported) data. The code generator aligns the imported or exported data to the alignment boundary (align_value).

example

Examples

collapse all

An example function that specifies data alignment for imported data.

function y = importedDataExampleFun(x1,x2)

coder.dataAlignment('x1',16); % Specifies information coder.dataAlignment('x2',16); % Specifies information coder.dataAlignment('y',16); % Specifies information

y = x1 + x2;

end

An example function that specifies data alignment for exported data.

function a = exportedDataExampleFun(b)

global z; coder.dataAlignment('z',8);

a = b + z;

end

Input Arguments

collapse all

The varName is a character array of the variable name that requires alignment information specification.

The alignvalue is an integer number which should be a power of 2. This number specifies the power-of-2 byte alignment boundary.

Limitations

Limitations on variables supported by coder.dataAlignment directive:

Tips

Extended Capabilities

Version History

Introduced in R2017a