matlab - Find Date Range Rows and Extract -
this should straight-forward in matlab don't know how , stuck. have data looks below in form: mm/dd/yyyy hh:mm windspeed
- hourly data spanning years 1991 present (2013) of cell arrays , numeric array:
8/22/1993 23:00 2.381453514 8/23/1993 0:00 3.39369154 8/23/1993 1:00 5.398661613 8/23/1993 2:00 7.231492996 8/23/1993 3:00 9.187699318 8/23/1993 4:00 9.802619934 8/23/1993 5:00 8.85418129 8/23/1993 6:00 9.889941216 8/23/1993 7:00 10.4628706 8/23/1993 8:00 10.8967123 8/23/1993 9:00 10.12729263 8/23/1993 10:00 9.106620789 8/23/1993 11:00 7.600066185 8/23/1993 12:00 6.597990036 8/23/1993 13:00 6.764455795 8/23/1993 14:00 7.360760689 8/23/1993 15:00 5.828835011
i trying extract third column (windspeed
). need able change date range extract month @ time example rows containing month "08" august of year 1993 , future use rows containing "09" september , year 2013. i'm not sure if it's better use datenum
or find function , how code either case.
using xlsread
read .csv
file portion of data shown above.
i don't know how import data now, , variables in workspace are, here's way it:
find xxx.csv
-file in current folder
window in matlab. double click import it. in window appears, can select delimiter: space
. play around settings, find "best fit"
now, have variable in matlab workspace.
hhv = datevec(hh); % interested in column 4, hour: % hhv matrix [2013, 1, 1, hour, 0, 0]
now, if want windspeeds between 0:00 , 06:00 08/23/1993:
winds = ws(dt == datenum(1993,8,23) & hhv(:,4) >= 0 & hhv(:,4) < 6) winds = 3.3937 5.3987 7.2315 9.1877 9.8026 8.8542
Comments
Post a Comment