congregate

version 1.0.0 (8.03 KB) by Anver Hisham
Fetch values from an array of cells (or an array of structures) and create a matrix.

2 Downloads

Updated 31 Mar 2019

From GitHub

View License on GitHub

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 (2022). congregate (https://github.com/anverhisham/congregate), GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2019a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.