フィルターのクリア

Accessing elements in a struct with a string

2 ビュー (過去 30 日間)
kevin
kevin 2013 年 12 月 2 日
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.

回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by