Use cell instead of struct, while keeping data's organization

2 ビュー (過去 30 日間)
Science Machine
Science Machine 2022 年 7 月 19 日
コメント済み: dpb 2022 年 7 月 19 日
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
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 ExchangeStructures についてさらに検索

タグ

製品


リリース

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by