How to merge cell arrays with different dimensions?

6 views (last 30 days)
I have two cell arrays. The first one (A) has 1x14 cells, and the second (B) has 1x7 cells. I would like to create an array (or a table) that would consists of two arrays in vertical merging. The commands e.g. table(A,B) etc. shows me error about the dimensions of each one.
Could you please help me ?
  2 Comments

Sign in to comment.

Accepted Answer

Ivan Mich
Ivan Mich on 5 Nov 2022
system('copy file1.txt+file2.txt+file3 OUTPUT_Merged_file.txt');
This is the solution

More Answers (1)

Walter Roberson
Walter Roberson on 2 Feb 2022
T = table(A{:});
temp = cell(1, length(A));
temp(1:length(B)) = B;
T = [T; temp];
Note that using [] between a table and a cell array has the effect of inserting the content of the cell array as additional rows in the table.
  5 Comments
Ivan Mich
Ivan Mich on 5 Nov 2022
system('copy file1.txt+file2.txt+file3 OUTPUT_Merged_file.txt');
This is the solution

Sign in to comment.

Categories

Find more on Cell Arrays 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!

Translated by