필터 지우기
필터 지우기

How to find unique lines in cell arrays

조회 수: 1 (최근 30일)
Artyom
Artyom 2013년 8월 7일
How to find unique lines in the next cell array:
15 'm'
18 'm'
15 'm'
So the result will be:
15 'm'
18 'm'

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 8월 7일
use unique function
  댓글 수: 2
Artyom
Artyom 2013년 8월 7일
Unique works only with cell array of strings.
Azzi Abdelmalek
Azzi Abdelmalek 2013년 8월 7일
a={15 'm'; 18 'm'; 15 'm';13 'r';15 'm'}
b=cellfun(@num2str,a,'un',0)
c=arrayfun(@(x) horzcat(b{x,:}),(1:size(a,1))','un',0)
[idx,idx]=unique(c)
out=a(idx,:)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by