how can i combine arrays of different size.
조회 수: 4 (최근 30일)
이전 댓글 표시
i have six arrays of size as given in figure.
i need to combine all arrays one after the other.
but the problem is they are of different dimenion.
how can i combine all these arrays?![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/637915/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/637915/image.png)
thanks in advance.
댓글 수: 4
채택된 답변
Walter Roberson
2021년 5월 31일
sizes = cell2mat(cellfun(@size, YourCell(:), 'uniform', 0));
maxcols = max(sizes(:,2));
combined = cell2mat(cellfun(@(M) [M, zeros(size(M,1), maxcols-size(M,2))], YourCell(:), 'uniform', 0));
댓글 수: 0
추가 답변 (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!