How to Horizontally concatenate the values of a matrices present inside a cell array using loops?

2 views (last 30 days)
I have a 1x8 Cell Array(A) with elements composed of the following dimension.
10x13x2 double 10x13x2 double 10x13x2 double 10x13x2 double 10x13x2 double 10x13x2 double 10x13x2 double 10x13x2 double
where,
A(:,:,1) = 10x13 matrix(130 values)
A(:,:,2) = Another 10x13 Matrix(130 values)
Now i want to horizontally concatenate A(:,:,1) and A(:,:,2) so that i get a total of 260 values by concatenating 2 matrices in each cell. i need to concatenate it like say A(:,:,1) is M and A(:,:2) is V. so i need to concatenate horizontally like [M1 V1]..[MN VN].
So, finally i have to get an value of a 1x8 cell array like the below
MxNX1 MxNX1 MxNX1 MxNX1 MxNX1 MxNX1 MxNx1 MxNX1
where MXN = 260(130 + 130 Values concatenated horizontally),
Kindly suggest how to do this, if it involves reshaping and loops kindly suggest me how to do this?

Accepted Answer

KL
KL on 13 Dec 2017
if C is your cell array,
x = cellfun(@(x)reshape(x,size(x,1),[]),C,'uni',0)

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!