Filter table data by character string

11 views (last 30 days)
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 == '?????',:)

Accepted Answer

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

More Answers (0)

Categories

Find more on Tables 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!