Use cell instead of struct, while keeping data's organization
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a multi-level structure
Struct1=u(t).a(p).b(q).c(r).dat,
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
Struct2=fft_x(u)=w.
After that, I would like to re-arrange Struct2 to expose now say the
r_1 ,..., r_n
parameters,
Struct3=w(t).a(p).x(x).dat(r_1:r_n)
I now do another math operation on the exposed array elements
r_1:r_m
, 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)
댓글 수: 1
dpb
2022년 7월 19일
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.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!