congregate
DETAILED DESCRIPTION
Have you ever tried to create a submatrix from an array of cells? Or extract values of a specific member from an array of strctures? If so, this function is for you!! Please see the examples below to get more info upon this function.
EXAMPLES
1. Extracting submatrix from an array of cells
A = {11,12,13;21,22,23};
congregate('A{1:2,2:3}')
ans =
12 13
22 23
2. Converting an array of structures to a 2x3 matrix
S(1).a=[1,2,3]';
S(2).a=[4,5,6]';
congregate('S(:).a')
ans =
1 2 3
4 5 6
3. Converting an array of structures of structures to a 2x2x3 matrix
T(1).a(1).b=[111,112,113]';
T(1).a(2).b=[121,122,123]';
T(2).a(1).b=[211,212,213]';
T(2).a(2).b=[221,222,223]';
congregate('T(:).a(:).b')
ans(:,:,1) =
111 121
211 221
ans(:,:,2) =
112 122
212 222
ans(:,:,3) =
113 123
213 223
Cite As
Anver Hisham (2024). congregate (https://github.com/anverhisham/congregate), GitHub. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Versions that use the GitHub default branch cannot be downloaded
Version | Published | Release Notes | |
---|---|---|---|
1.0.0 |
|