テーブルの日時が重複する行を削除したい

15 vues (au cours des 30 derniers jours)
Yu
Yu le 1 Sep 2021
Commenté : Yu le 1 Sep 2021
こんにちは。
添付のsampleの5列目にタイムスタンプ(timestamp_JST)があり、これが重複している行を削除したいのですが上手くいきません。
良い方法をご存知の方がいらっしゃいましたらご教示ください。

Réponse acceptée

Atsushi Ueno
Atsushi Ueno le 1 Sep 2021
load('sample1.mat');
[~,ia] = unique(sample1.timestamp_JST,'stable');
B = sample1(ia,:)
B = 5×5 table
GPS_fix GPS_date GPS_time GPS_milliseconds timestamp_JST _______ ___________________ ___________________ ________________ ___________________ 0 2021/07/03 00:00:00 2021/09/01 23:44:35 162 2021/07/04 08:44:35 2 2021/07/03 00:00:00 2021/09/01 23:44:36 162 2021/07/04 08:44:36 4 2021/07/03 00:00:00 2021/09/01 23:44:37 162 2021/07/04 08:44:37 6 2021/07/03 00:00:00 2021/09/01 23:44:38 162 2021/07/04 08:44:38 8 2021/07/03 00:00:00 2021/09/01 23:44:39 162 2021/07/04 08:44:39
  1 commentaire
Yu
Yu le 1 Sep 2021
早速ありがとうございます!
なるほど、uniqueでtimestamp_JST列の一意の変数の行インデックスを検索するということですね。
[~,] の意味も勉強になりました。
ありがとうございました!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 行列および配列 dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!