Use cell instead of struct, while keeping data's organization
1 view (last 30 days)
Show older comments
Science Machine on 19 Jul 2022
Commented: dpb on 19 Jul 2022
I have a multi-level structure
where each field has hundreds of subfields.
Initially I am doing a math operation (fft) on the array that's exposed at the end of the structure, to get
After that, I would like to re-arrange Struct2 to expose now say the
r_1 ,..., r_n
I now do another math operation on the exposed array elements
, and so on: rearrange the fields to expose, then do a math operation.
- Note that I would like the grab also the inner field also.
- Is there a data structure that would be better than struct? I would like organize my data in terms of something more flexible such as cells. However, I need to keep tabs on the data in the same way as structs do.
- I want to employ different data structure not only because speed concerns --- multiple for loops to reorganize data (3 layers of nesting) is not vectorized and hence really slow. I also would like to use gpu (so structs are no good for that)
dpb on 19 Jul 2022
I think you'd have to outine the data and objectives in sufficient detail somebody could try to design a better data structure that matches the problem -- I think simply trying to make sense of such a convoluted struct as you have described isn't going to happen for anybody on the outside without your inside knowledge of the problem.
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!