How to concatenate lines in cell arrays
조회 수: 7 (최근 30일)
이전 댓글 표시
Hi,
I have a Cell array, name DATA with 5*50 cells. Each cell has a 1000*30 matrix
I would like to obtain a new matrix that contains the concatenation of the column 1 and all lines (:,1), for all the 50 columns. I need all the lines of all cells in all columns to show up as a resulting matrix, named MR, of dimensions 40000*50.
Right now I have the following code:
for j=1:1:50
MR(:,j)=cat(1,DATA{1,j}(:,1),DATA{2,j}(:,1),DATA{3,j}(:,1),DATA{4,j}(:,1),DATA{5,j}
end
However, the code write all the columns with the same values, so definitely there is something wrong with it. Any help is appreciated.
Best regards,
댓글 수: 3
Jan
2022년 3월 16일
So you have a {5 x 50} cell array containing [1000 x 1] vectors. Then I still do not understand, how you can obtain a [40000 x 50] matrix.
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!