access data in a nested struct

2 ビュー (過去 30 日間)
Mark Golberg
Mark Golberg 2020 年 6 月 30 日
編集済み: SC 2020 年 6 月 30 日
Hello,
I have a struct with several levels. For example:
s.L1.L2.L3
what would be the most efficient way to look for a string in Level L3?
Thanks!

採用された回答

SC
SC 2020 年 6 月 30 日
編集済み: SC 2020 年 6 月 30 日
Let us name your string field inside L3 as 'Name'.
If you want to access data inside a nested struct,
You can do it by, s.L1.L2.L3.Name = 'String'
For more information on accessing nested structs refer to the following: https://www.mathworks.com/help/matlab/matlab_prog/access-data-in-nested-structures.html

その他の回答 (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