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

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

Akzeptierte Antwort

Atsushi Ueno
Atsushi Ueno am 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 Kommentar
Yu
Yu am 1 Sep. 2021
早速ありがとうございます!
なるほど、uniqueでtimestamp_JST列の一意の変数の行インデックスを検索するということですね。
[~,] の意味も勉強になりました。
ありがとうございました!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 行列および配列 finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!