Accessing elements in a multilevel structure
Show older comments
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.
Accepted Answer
More Answers (0)
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!