Flatten nested cell arrays
Version 1.0.0.1 (1.29 KB) by
Manu R
Linearize a cell array tree structure
C1 = flatten({{1 {2 3}} {4 5} 6})
C2 = flatten({{'a' {'b','c'}} {'d' 'e'} 'f'})
% Outputs:
C1 =
[1] [2] [3] [4] [5] [6]
C2 =
'a' 'b' 'c' 'd' 'e' 'f'
Cite As
Manu R (2024). Flatten nested cell arrays (https://www.mathworks.com/matlabcentral/fileexchange/27009-flatten-nested-cell-arrays), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2010a
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Language Fundamentals > Matrices and Arrays >
- MATLAB > Language Fundamentals > Data Types >
Find more on Matrices and Arrays in Help Center and MATLAB Answers
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.