How to combine cell arrays with different dimensions?
조회 수: 9 (최근 30일)
이전 댓글 표시
Hello guys!
I have a cell array of a size 2*117 like this:![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1139000/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1139000/image.png)
I want to combine two rows such that resulting cell array is 1*117, i.e.there is only single row.
for example, from above image, output should be something like this:
1*117 cell
1 2 3 4 5
400*1 double 480*1 double 460*1double 560*1 double 400*1double ...............so on................
Thank you!!!
댓글 수: 0
채택된 답변
the cyclist
2022년 9월 28일
Here is one way:
% Simplified version of your data
C = {rand(2,1), rand(3,1);
rand(5,1), rand(7,1)};
% Concatenate the two rows
cellfun(@(x,y)[x;y],C(1,:),C(2,:),'UniformOutput',false)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!