How to combine cells from cell array with a loop
조회 수: 8 (최근 30일)
이전 댓글 표시
I have a cell array with 200 cells called data. Each cell contains a matrix NxM. M is the same on every cell. I am trying to get everything in one cell/vector.
What I did:
for i = 1:1:200
C = cell2mat(data(i))
end
This does give me all the outputs needed, but how can I assign automatic Variables to every output, so that I can get them all in on cell with
ALLCELL = [C1:C200]
Greatly appreciate any help.
댓글 수: 2
Bruno Luong
2020년 7월 27일
편집: Bruno Luong
2020년 7월 27일
Have you tried (no loop)
ALLCELL = cell2mat(data(:));
Or
ALLCELL = cat(1, data{:});
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!