Remove dulpicate rows of cell array

Hi,
i need to remove duplicated rows of cell array and keep the row only one time.
For example from array 3x5:
{'800AL'} {'800AL'} {'800AL'} {'800AL'} {'800AL'}
{'700AL'} {'700AL'} {'700AL'} {'700AL'} {'700AL'}
{'800AL'} {'800AL'} {'800AL'} {'800AL'} {'800AL'}
i would like to keep a table with dimension 2x5:
{'800AL'} {'800AL'} {'800AL'} {'800AL'} {'800AL'}
{'700AL'} {'700AL'} {'700AL'} {'700AL'} {'700AL'}
I tried the unique function but i can't keep the whole row.
Any idea on that?
Thanks in advance

답변 (1개)

Awais Saeed
Awais Saeed 2021년 12월 9일
편집: Awais Saeed 2021년 12월 9일

0 개 추천

C = {{'800AL'} {'800AL'} {'800AL'} {'800AL'} {'800AL'}
{'700AL'} {'700AL'} {'700AL'} {'700AL'} {'700AL'}
{'800AL'} {'800AL'} {'800AL'} {'800AL'} {'800AL'}};
cell2str = string(C); % convert cell to string
unique(cell2str, 'rows', 'stable')
ans = 2×5 string array
"800AL" "800AL" "800AL" "800AL" "800AL" "700AL" "700AL" "700AL" "700AL" "700AL"

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

질문:

2021년 12월 9일

편집:

2021년 12월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by