erasing specifi rows from a cell matrix

Dear all,
I have
A={
'12/08' ' '
'01/09' ' '
'02/09' ' '
'03/09' ' '
'03/09' ' '
'04/09' ' '
'05/09' ' '
'06/09' ' '
'07/09' ' '
'08/09' ' '
'09/09' ' '
'10/09' ' '
'11/09' ' '
'12/09' ' '
'01/10' '33 '
'01/10' '55 '
'02/10' ' '
'03/10' ' '
'04/10' ' '
'05/10' ' '
'06/10' ' '
'07/10' ' '
'08/10' ' '
'09/10' ' '
'10/10' ' '
'11/10' ' '
'12/10' ' '
'01/11' '123 '
'01/11' ' 321'
'02/11' ' '
'03/11' ' '
'04/11' ' '
'05/11' ' '
'06/11' ' '
'07/11' ' '
'08/11' ' '
'09/11' ' '
'10/11' ' '
'11/11' ' '}
I want to erase the second duplicate so as to have
A={
'12/08' ' '
'01/09' ' '
'02/09' ' '
'03/09' ' '
'03/09' ' '
'04/09' ' '
'05/09' ' '
'06/09' ' '
'07/09' ' '
'08/09' ' '
'09/09' ' '
'10/09' ' '
'11/09' ' '
'12/09' ' '
'01/10' '33 '
'02/10' ' '
'03/10' ' '
'04/10' ' '
'05/10' ' '
'06/10' ' '
'07/10' ' '
'08/10' ' '
'09/10' ' '
'10/10' ' '
'11/10' ' '
'12/10' ' '
'01/11' '123 '
'02/11' ' '
'03/11' ' '
'04/11' ' '
'05/11' ' '
'06/11' ' '
'07/11' ' '
'08/11' ' '
'09/11' ' '
'10/11' ' '
'11/11' ' '}
thanks

1 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 8 月 2 日
what about
'03/09' ' '
'03/09' ' '
they are identical, will you remove one ?

サインインしてコメントする。

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 8 月 2 日
編集済み: Azzi Abdelmalek 2012 年 8 月 2 日

0 投票

[x,y]=unique(A(:,1),'stable');A=A(y,:)

その他の回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2012 年 8 月 2 日
編集済み: Andrei Bobrov 2012 年 8 月 2 日

0 投票

[~,b] = unique(A(:,1),'first')
Aout=A(sort(b),:)
or
[c,c,c] = unique(A(:,1));
Aout=A(~([false;diff(c)==0]&~cellfun(@isempty,regexp(A(:,2),'\d*'))),:);

3 件のコメント

Sabbas
Sabbas 2012 年 8 月 2 日
Hi andrei,
the code above erases the first and not the second duplicate
thanks
Andrei Bobrov
Andrei Bobrov 2012 年 8 月 2 日
no, erases the second duplicate
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 8 月 2 日
no, does'nt erase the second, it erase the second after sorting, for example change a value 321 with 32.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeData Types についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by