coder.dataAlignment
Specify data alignment for global or entry-point/exported function input and output arguments
Description
coder.dataAlignment(
specifies data alignment in MATLAB® code for the variable ('varName'
,align_value
)varName
), which is imported
data or global (exported) data. The code generator aligns the imported or exported
data to the alignment boundary (align_value
).
Note
To use data alignment, you must specify the alignment information for the compiler by using a code replacement library registration. For more information, see Provide Data Alignment Specifications for Compilers.
Examples
Input Arguments
Limitations
Limitations on variables supported by coder.dataAlignment
directive:
Only use
coder.dataAlignment
to specify alignment information for function inputs, outputs, and global variables.coder.dataAlignment
supports only matrix types, including matrix of complex types.For exported custom storage classes (CSCs),
coder.dataAlignment
supports onlyExportedGlobal
. You can specify alignment information for any imported CSCs.The code generator ignores
coder.dataAlignment
for non-ERT or non-ERT derived system target files.Global variables tagged using the
coder.dataAlignment
directive from within a MATLAB function block are ignored. Set the alignment value on the corresponding Data Store Memory.The
coder.dataAlignment
function generates an error if a code replacement library is not specified. For more information, see Provide Data Alignment Specifications for Compilers.
Tips
To prevent inlining a function containing an aligned variable in the generated code, a best practice is to call
coder.inline('never')
in your code.
Extended Capabilities
Version History
Introduced in R2017a