Accessing elements in a multilevel structure
Ältere Kommentare anzeigen
I have a struct that contains many other structs. There are several patients. Each patient contains several lesions. And each lesion has various properties. So there are three nested structs. The overall patient struct, the lesion struct, and then the properties struct. For further clarification, here is a quick example. Patient(1) contains Lesion(1), Lesion(2), Lesion(3). Each Lesion has a size, type, etc associated with it.
I would like to know how to access the following information efficiently:
- The sizes of all lesions. Such as: Patients(:).Lesion(:).size
- The sizes of one patients lesions. Such as: Patient(1).Lesion(:).size
- The sizes of all patients lesions of a particular type. Such as: Patients(:).Lesion(if Lesion.type==normal).size
- The sizes of one patients lesion of a particular type. Such as: Patient(1).Lesion(if Lesion.type == normal).size
Thanks in advance.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Structures finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!