How to write a function to delete the duplicated arrays?
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
Hi, I have tried to write a function that finding to duplicated numbers and remove them in my array. I know the unique function is useful for such kind of problems but it is not for me. For instance,my array is [1 2 2 2 3 1]. I want to delete the consecutive numbers such [1 2 3 1]. Please help me about this.
0 件のコメント
回答 (2 件)
Jos (10584)
2014 年 5 月 3 日
A = [1 2 2 2 3 1 1]
tf = [true diff(A)~=0]
B = A(tf)
2 件のコメント
guven baykus
2014 年 5 月 3 日
Jan
2014 年 5 月 3 日
And Jos' solution does reply [1,2,3,1]. Therefore I'm convinced, that it is useful. +1
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!