Merge rows of cell array with strings per column?
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a cell array of 2xn with strings and I would like to merge the text of all rows on a per column base, effectively yielding a 1xn cell array. To illustrate I have something like this...
[{'A'} {'C'}; {'B'} {'D'}]
... and would like something like this:
[{'AB'} {'CD'}]
댓글 수: 0
채택된 답변
Stephen23
2022년 10월 4일
C = {'A','C'; 'B','D'}
D = cellfun(@(c)join(c,''),num2cell(C,1))
D = cellfun(@(c)[c{:}],num2cell(C,1),'uni',0)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!