Reshape nested cell arrays into the a different nested cell array organization
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Alyssa
am 2 Aug. 2024
Beantwortet: Walter Roberson
am 2 Aug. 2024
Hello, I have a nested cell array that has been built up such that the first level cell array A is {691x1}; within each cell in A, there is a second level cell array B of {48x1}; lastly within each cell in B there is a third level nested cell array C of {2x1}.
I want to reshape the nested cell array structure such that it is now organized in the order of cell array B {48x1} first; second level cell array C {2x1} and lastly a third level cell array of A {691x1}.
Is there a way to take the original cell array and use a specific function (such as reshape) to get my desired new nested cell array from my current nested cell array?
have: A {691x1} --> B{48x1} --> C{2x1}
want: B{48x1} --> C{2x1} --> A {691x1}
Thanks!
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 2 Aug. 2024
No, there is no way to do it.
Consider that you have your B 48 x 1 for each A 691 x 1. So there are 48*691 = 33168 different B. But you want to reorder it so there are only 48 different B. You would have to discard 33120 of the contents of B.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!