Character Cell Array Comparison
조회 수: 1 (최근 30일)
이전 댓글 표시
Ok, so excuse me; new to matlab and have not found a solution through google. I have a 3x2 cell array for example:
test = {'apple' 'banana'; 'banana' 'apple'; 'pear' '[]'}
And I want to compare the two columns (or however many there are) and return an array of all values that match. i.e return apple and banana from the test cell given. Essentially it just needs to discard any empty or unique values.
Any help much appreciated.
댓글 수: 0
채택된 답변
Andrei Bobrov
2017년 6월 29일
편집: Andrei Bobrov
2017년 6월 29일
[a,~,c] = unique(test);
out = a(accumarray(c,1)>1 & ~strcmp(a,'[]'));
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Dialog Boxes에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!