Borrar filtros
Borrar filtros

Accessing elements in a struct with a string

2 visualizaciones (últimos 30 días)
kevin
kevin el 2 de Dic. de 2013
I have data that is stored in a struct and I do not always know the names of the fields. Example data.Struct3.Element5.a. If i have Struct3.Element5.a stored as a string, full_name{5,1}=Struct3.Element5.a, why can't i access it by data.(full_name2{5,1})? Returns Reference to non-existent field 'Struct3.Element5.a'. I can store each field in a seperat cell and access it like this data.(full_name(5,1).(full_name(5,2)).(full_name(5,3), but would rather not have to do this as the data may be stored in multiple nested structs.

Respuestas (0)

Categorías

Más información sobre Structures en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by