How can I dynamically create new structures out of existing ones?

5 views (last 30 days)
Can someone help me create the updated structure?
Thank you!
  3 Comments
Jan
Jan on 9 Jun 2022
@Yousra Ganouma: Follow Stephen's idea: Do not hide an index in the name of a field, but create an array instead, e.g.:
Data.EES{1}
Data.EES{2}
...
Data.Space(1).ESS{1}
Then the solution to split the data would be trivial and very efficient.
With hinding an index in the name you have decided for a representation of your data, which impedes the processing massively.

Sign in to comment.

Accepted Answer

Mitch Lautigar
Mitch Lautigar on 9 Jun 2022
Edited: Image Analyst on 9 Jun 2022
Convert the structure to a table, combine the tables, then convert back to structure.
Googling "struct2table" and "table2struct" will get you there.

More Answers (0)

Categories

Find more on Structures in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!