How do you vertically concatenate the rows of a cell array consisting of vectors of numbers?
조회 수: 25(최근 30일)
표시 이전 댓글
I want to vertically concatenate the elements of a cell array so that, for example, an array that is 3 x 9 becomes 1 x 9. How do I do that? The following concatenates everything into one dimension, which isn't what I want:
vertcat(cellarray{:});
채택된 답변
per isakson
2022년 3월 30일
Example
m = magic(3);
m = [m,m,m];
cac = num2cell(m); % sample data
arrayfun( @(ix) vertcat(cac{:,ix}), [1:9], 'uni',false )
Is this what you look for?
추가 답변(2개)
Walter Roberson
2022년 3월 30일
Output = arrayfun(@(ColIdx) vertcat(YourCell{:,ColIdx}), 1:size(YourCell,2), 'uniform', 0);
댓글 수: 0
참고 항목
범주
Find more on Data Type Identification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!