How to concatenate each element of a cell array across rows ?

조회 수: 8 (최근 30일)
DEEPAK PHCSFI17041149
DEEPAK PHCSFI17041149 2017년 12월 21일
댓글: DEEPAK PHCSFI17041149 2017년 12월 21일
I have a cell array of dimension 64x8 in which each row is comprised of the following dimension,
Say,
260x1 double 260x1 double 260x1 double 260x1 double 260x1 double 260x1 double 260x1 double 260x1 double
Now i need to horizontally concatenate each 260x1 element across the 8 rows, so i would get a 2080x1 matrix in a single cell. where 2080 is the product of 260x8 (along 8 rows). and this should transform the 64x8 Cell array to 64x1 array.
So i must get the output like the below,
2080x1
2080x1
......
......
......
2080x1
And kindly let me know if i have a way to do it without loops.

채택된 답변

Birdman
Birdman 2017년 12월 21일
for i=1:size(a,1)
a(i)={horzcat(a{i,:})};
a{i,1}=reshape(a{i,1},2080,1);
end
a(:,2:size(a,2))=[];
  댓글 수: 1
DEEPAK PHCSFI17041149
DEEPAK PHCSFI17041149 2017년 12월 21일
this is great Birdman, is there any way to do it without a loop?... if its there kindly let me know.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by