Unique an Array based on one of the columns

4 ビュー (過去 30 日間)
civil tech
civil tech 2023 年 4 月 29 日
コメント済み: Image Analyst 2023 年 4 月 30 日

I have a table bellow with more than 1000 rows:

The table has six columns. I want to remove the repeated rows with consideration of "Email" column. In another hand, if ithe eamil presents in one row is the same as the email presents in another row, just keep one of these repeated rows (I prefer to keep the last row). How can I do this?

  4 件のコメント
Walter Roberson
Walter Roberson 2023 年 4 月 29 日
splitapply(@unique ) with the group determined by the email column (might need findgroups)
civil tech
civil tech 2023 年 4 月 29 日
移動済み: Walter Roberson 2023 年 4 月 29 日
This command " RR_new= unique(RR.Email) " return a unique table with only one column (email). I need the whole six columns.

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

採用された回答

Walter Roberson
Walter Roberson 2023 年 4 月 29 日
移動済み: Image Analyst 2023 年 4 月 30 日
In summary: use the second output of unique() to get the list of indices of table rows to index the table by.
You would not be applying unique to the Email -- you would be applying findgroups() to the email to get the grouping variable for splitapply
  2 件のコメント
civil tech
civil tech 2023 年 4 月 30 日
移動済み: Image Analyst 2023 年 4 月 30 日
Thanks a lot.
Image Analyst
Image Analyst 2023 年 4 月 30 日
If this Answer solves your original question, then could you please click the "Accept this answer" link to award the answerer with "reputation points" for their efforts in helping you? They'd appreciate it. Thanks in advance. 🙂 Note: you can only accept one answer (so pick the best one) but you can click the "Vote" icon for as many Answers as you want. Voting for an answer will also award reputation points.

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by