This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.


Arrays with named fields that can contain data of varying types and sizes

A structure array is a data type that groups related data using data containers called fields. Each field can contain any type of data. Access data in a structure using dot notation of the form structName.fieldName. For more information, see Create Structure Array or watch Introducing Structures and Cell Arrays.


structStructure array
fieldnamesField names of structure, or public fields of COM or Java object
getfieldField of structure array
isfieldDetermine whether input is structure array field
isstructDetermine whether input is structure array
orderfieldsOrder fields of structure array
rmfieldRemove fields from structure
setfieldAssign values to structure array field
arrayfunApply function to each element of array
structfunApply function to each field of scalar structure
table2structConvert table to structure array
struct2tableConvert structure array to table
cell2structConvert cell array to structure array
struct2cellConvert structure to cell array

Examples and How To

Create Structure Array

This example shows how to create a structure array and access data within in.

Access Data in a Structure Array

This example shows how to access the contents of a structure array.

Concatenate Structures

Concatenate structure arrays using the [] operator. To concatenate structures, they must have the same set of fields, but the fields do not need to contain the same sizes or types of data.

Generate Field Names from Variables

Dynamically determine a structure field name at run time from a variable or expression.

Access Data in Nested Structures

Index into a structure that is nested within another structure.

Access Elements of a Nonscalar Struct Array

Access and process data from multiple elements of a nonscalar structure array.


Cell vs. Struct Arrays

This example compares cell and structure arrays, and shows how to store data in each type of array. Both cell and structure arrays allow you to store data of different types and sizes.

Ways to Organize Data in Structure Arrays

Consider how you plan to access data and system memory constraints when determining how to organize the data in a structure array.

Memory Requirements for a Structure Array

Structure arrays do not require contiguous memory. However, each field requires contiguous memory, as does the header describes the array.

Was this topic helpful?