Filter table data by character string

4 次查看(过去 30 天)
Assume I have the following data:
date = datetime - days(1:5:21)' + hours(randn(5,1));
x = randn(5,1);
y = randn(5,1);
data = table(date,x,y)
data =
date x y
____________________ ________ ________
09-Nov-2016 17:08:01 -1.0891 0.085931
04-Nov-2016 14:49:53 0.032557 -1.4916
30-Oct-2016 15:58:21 0.55253 -0.7423
25-Oct-2016 15:22:32 1.1006 -1.0616
20-Oct-2016 16:43:06 1.5442 2.3505
How can I filter for all rows with entrys in column date including a string "Nov", so that I get all the data for November?
November = data(data.date == '?????',:)

采纳的回答

Alexandra Harkai
Alexandra Harkai 2016-11-10
November = data(11 == month(data.date),:)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Dates and Time 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by