how to remove repeating rows from a matrix?

I know "union" can be used to achieve this, for example, there is an A,
A =
1 2
1 2
1 3
B=union(a,a,'rows')
B =
1 2
1 3
but if A is big(In my case, A is a 20,000*30 matrix), it will be out of memory.
??? Out of memory. Type HELP MEMORY for your options.
ARE there simple ways to delete repeating arrows in a matrix? THX!

2 件のコメント

Florin Neacsu
Florin Neacsu 2011 年 10 月 12 日
Hi,
Are your repeating lines always one after another? If so, you could use diff and look for [0 0].
Zhang
Zhang 2011 年 10 月 13 日
No, they are not always one after another.thx

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

回答 (2 件)

Andrei Bobrov
Andrei Bobrov 2011 年 10 月 12 日

1 投票

unique(A,'rows')

1 件のコメント

Zhang
Zhang 2011 年 10 月 13 日
Thx, Andrei, yes, it is more simple, but still out of memory in my real case

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

Steven
Steven 2011 年 10 月 12 日

0 投票

Or even simpler for quick remove :
A(2,:)=[]
will give you B.

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

質問済み:

2011 年 10 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by