フィルターのクリア

Selecting specific values in timestamp

3 ビュー (過去 30 日間)
Sam
Sam 2020 年 3 月 2 日
回答済み: Sai Sri Pathuri 2020 年 3 月 5 日
Hello,
I have a 7000000x8 matrix. In the second column, I have the timestamp information (e.g.: 11/02/2020 14:19:34.000). My sampling frequency is 25 Hz. In the 7th column I have temperature data. The timestamp column has continuous data for 4 consequetive days. How can I select the temperature data on 12/02/2020 14:00:00.000 until 12/02/2020 15:30:00.000? Or how can I find the indices of a specific timestamp in order to retrieve the temperature data?
Thank you.

回答 (1 件)

Sai Sri Pathuri
Sai Sri Pathuri 2020 年 3 月 5 日
Assuming you have a
  • Table t of size 7000000x8 with column names timestamp and temperature for timestamp (2nd column) and temperatue (4th column) data respectively. You may find the indices containing the required timestamps as below
first_index = find(ismember(t.timestamp,'12/02/2020 14:00:00.000','rows'))
last_index = find(ismember(t.timestamp,'12/02/20201 5:30:00.000','rows'))
Now temperature data can be obtained from these indices
temperatureData = t.temperature(first_index:last_index)
  • Cell array c of size 7000000x8. You may find the indices containing the required timestamps as below. Note that ‘2’ is the column containing timestamp values
first_index = find(ismember(c(:,2),'12/02/2020 14:00:00.000'))
last_index = find(ismember(c(:,2),'12/02/20201 5:30:00.000'))
Now temperature data (column = ‘4’) can be obtained from these indices.
temperatureData = c(first_index:last_index,4)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by