How to remove common row elements from matrix

2 ビュー (過去 30 日間)
Poulomi Ganguli
Poulomi Ganguli 2020 年 7 月 8 日
コメント済み: Poulomi Ganguli 2020 年 7 月 8 日
Hello:
I have large number of arrays with mix of NaNs & numbers, for example:
NaN NaN NaN NaN NaN NaN 1973 1 15 1973 4 14 90
1979 11 3 12 22 10 1979 11 25 1980 1 5 64
1980 4 15 1 2 1 1980 4 17 1980 5 17 33
2017 10 23 5 7 2 2017 10 30 2018 6 10 231
NaN NaN NaN NaN NaN NaN 2018 1 23 2018 7 21 180
NaN NaN NaN NaN NaN NaN 2018 6 14 2018 7 21 38
2018 10 2 17 22 5 2018 10 24 2018 12 31 91
I need to identify the row-wise common datetime elements, for example, rows 5 and 6 here, where Year-month-day of cols. 10-12 are common. My desired output would be identify such common rows from each iteration and delete that particular row. For example, desired output here would be:
Nan NaN NaN NaN NaN NaN 1973 1 15 1973 4 14 90
1979 11 3 12 22 10 1979 11 25 1980 1 5 64
1980 4 15 1 2 1 1980 4 17 1980 5 17 33
2017 10 23 5 7 2 2017 10 30 2018 6 10 231
NaN NaN NaN NaN NaN NaN 2018 1 23 2018 7 21 180
2018 10 2 17 22 5 2018 10 24 2018 12 31 91
Any suggestions how to automate this operation?

採用された回答

dpb
dpb 2020 年 7 月 8 日
[~,ia]=unique(A(:,10:12),'rows');
O=A(ia,:);
  1 件のコメント
Poulomi Ganguli
Poulomi Ganguli 2020 年 7 月 8 日
Thanks a bunch! It works.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by