指定した時刻の範囲の行を、元のテーブルから抽出して、新しいテーブルを作りたい
9 views (last 30 days)
Show older comments
一つのテーブルの中に、Var1、Var2、・・・、時刻データ(yyyy/mm/dd HH:mm:ss形式)数か月分あるのですが、
その中で、特定の時間帯(例えば06:00:00~12:00:00)のデータ行だけを、抜き取って新しいテーブルを作ることは出来るのでしょうか?
0 Comments
Accepted Answer
Atsushi Ueno
on 20 Mar 2023
oldT = timetable2table(readtimetable('outages.csv')); % サンプルデータ(時刻データは1列目にあるものとする)
tod = timeofday(oldT{:,1}); % 時刻データは1列目にあるものとする。これを抜き出し日付データを除く
newT = oldT(tod > '06:00:00' & tod < '12:00:00', :) % 特定の時間帯のデータ行だけを抜き取って新しいテーブルを作る
3 Comments
Atsushi Ueno
on 20 Mar 2023
こちらは timetable 版です。
oldTT = readtimetable('outages.csv'); % サンプルデータ(時刻データは1列目にあるものとする)
tod = timeofday(oldTT.OutageTime); % 時刻データを抜き出し日付データを除く
newTT = oldTT(tod > '06:00:00' & tod < '12:00:00', :); % 特定の時間帯のデータ行だけを抜き取って新しいテーブルを作る
More Answers (0)
See Also
Categories
Find more on Dictionaries in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!