How to vertcat 100 matrices ?
Show older comments
Hi. Suppose I have 100 numbers of (m*3) matrices. These matrices have different numbers of rows and same numbers of columns. I want to add them vertically and use the vertcat command in Matlab. How can I do that? Thanks for your help.
1 Comment
Simply ensure that all of the matrices are stored in one cell array C, and then all you need to do is use a comma-separated list with vertcat:
M = vertcat(C{:})
MATLAB code can be so neat, simple, and efficient when people take care to design their data well!
Whatever you do, avoid magically creating/loading/acessing lots of separate variable names: this is a design decision that some beginners use to force themselves to write slow, complex, buggy, obfuscated code. Read more here:
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!