Reputation: 13
I'm applying tall arrays to a couple of .csv files. The tall array looks like:
Timestamp wind_spd_sd wind_spd_mx
___________________ ___________ ___________
04/03/2016 00:00:01 0.57576 4.1
04/03/2016 00:03:01 0.53692 3.1
04/03/2016 00:06:01 0.35642 4.2
04/03/2016 00:09:01 0.63012 4.9
04/03/2017 00:12:01 0.30357 3.7
04/03/2017 00:15:01 0.53442 10
: : :
: : :
I want to be able to select the rows of data between specific dates and times. I came across "timerange" which is used for timetables and used it as:
S1 = timerange('01/01/2015 08:00:00','12/18/2016 12:00:00')
S2 = tt{S1,:}
but had the error: "Subscripting using TIMERANGE is only supported for selecting rows of a timetable."
I then tried using datenum as:
t_start = datenum('04/03/2014 00:00:01', 'dd/MM/yyyy HH:mm:ss');
t_end = datenum('04/03/2015 00:03:01', 'dd/MM/yyyy HH:mm:ss');
rows = find(tt.Timestamp>t_start)
and the error was: "Undefined function 'find' for input arguments of type 'tall'"
I'm not 100% sure if the problem is definitely tall arrays or that I'm making a mistake in how I use these functions. Is there a way to do what I'm trying to achieve here with tall array?
Upvotes: 1
Views: 510
Reputation: 148
You were on the right track with your use of the timerange
function. However, you need to convert your tall
array to a timetable
, which is a specific data type. Do this first:
TT = table2timetable(tt);
S1 = timerange('01/01/2015 08:00:00','12/18/2016 12:00:00')
S2 = TT(S1,:);
Upvotes: 2