concatenate cell array of cell arrays

80 views (last 30 days)
Ghenji
Ghenji on 7 Jun 2018
Edited: Stephen23 on 23 Feb 2022
I have got this cell variable with 10 cell arrays. It is possible to horizontally concatenate them if the dimension is consistent but if not it gives me an error. How do i concatenate this cell arrays of unequal length?

Accepted Answer

Stephen23
Stephen23 on 7 Jun 2018
Edited: Stephen23 on 23 Feb 2022
  3 Comments
Ghenji
Ghenji on 7 Jun 2018
well well!! That worked. Thanks a lot Stephen.

Sign in to comment.

More Answers (1)

Rishabh Rathore
Rishabh Rathore on 7 Jun 2018
Edited: Rishabh Rathore on 7 Jun 2018
I'm assuming you want to retain the data of one cell array as a column.
A work around could be the following
  • Find the length of the longest cell array
  • append the empty cell to all the smaller cell arrays
  • finally concatenate them, you may use horzcat for horizontal concatenation.

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!