Main Content

Esta página aún no se ha traducido para esta versión. Puede ver la versión más reciente de esta página en inglés.

Estructuras

Arreglos con campos designados que contienen datos de diversos tipos y tamaños

Un arreglo de estructura es un tipo de dato que agrupa datos relacionados mediante contenedores de datos llamados campos. Cada campo puede contener cualquier tipo de datos. Para acceder a los datos de una estructura, es posible usar una notación punto con el formato structName.fieldName. Para obtener más información, consulte Create Structure Array o vea Introducción a estructuras y arreglos de celdas.

Funciones

structArray estructura
fieldnamesField names of structure, or public fields of Java or Microsoft COM object
getfieldField of structure array
isfieldDetermine if input is structure array field
isstructDetermine if input is structure array
orderfieldsOrder fields of structure array
rmfieldRemove fields from structure
setfieldAssign value 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

Temas

Create Structure Array

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

Access Data in 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.

Ways to Organize Data in Structure Arrays

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

Memory Requirements for Structure Array

Structure arrays do not require contiguous memory, but their fields do. Instead of incrementally increasing the number of fields or number of elements in a field, preallocate memory for fields containing very large arrays.

Cell vs. Structure 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.