Clear Filters
Clear Filters

how to concatenate cells arrays

1 view (last 30 days)
Mori
Mori on 8 Jul 2016
Answered: the cyclist on 9 Jul 2016
I have 2 cells array including A B , each has 4 cells. Each cell of A has 2 or 3 records (e.g. 10 columns and 1 row). B has 2 records.
How I can concatenate these two (A,B) to create new cell array C like below in the picture.
A={[1 1] [2 2 2]; [3 3] [4 4]} B={[5 5] [6 6]; [7 7] [8 8]} and I want
C={ [1 1 5 5] [2 2 2 6 6]; [3 3 7 7] [4 4 8 8] }
Thank you

Accepted Answer

the cyclist
the cyclist on 9 Jul 2016
A={[1 1] [2 2 2]; [3 3] [4 4]}
B={[5 5] [6 6]; [7 7] [8 8]}
C = cellfun(@(x,y)[x,y],A,B,'UniformOutput',false)

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!