having a 2 months timetable with 10 minute data points, is it possible to extract first half of each day using subscripting?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Andy
am 30 Mai 2018
Kommentiert: Peter Perkins
am 4 Jun. 2018
having a timetable, one can do sub-scripting once on the hole interval. can one take a sub-script of the daily data of such a timetable, and save it in another timetable?
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 30 Mai 2018
Bearbeitet: Ameer Hamza
am 30 Mai 2018
Yes, you can use subscript in MATLAB timetable class, similar to subscript in a MATRIX. For example to get the first half of the timetable you can use subscript like this
TT(1:end/2, :)
The exact detail of which subscript to use depends on the values you want to extract.
Edit: the updated answer according to your dataset is
TT_hours = hour(TT.Time);
index = d_hours <= 10 & d_hours >= 8;
TT_new = TT(index,:)
This will extract rows in which the hour is between 8 and 10.
5 Kommentare
Ameer Hamza
am 30 Mai 2018
Yes, The command posted in comments was just an example that timetable can use same indexing as matrices. Without watching a sample dataset, it is hard to suggest an exact solution. Please refer to updated answer.
Peter Perkins
am 4 Jun. 2018
Nothing wrong with Ameer's answer, but you might also try out
tr = timerange(hours(8),hours(10),'closed')
TTnew = TT(tr,:)
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Data Preprocessing 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!