Filter table data by character string

19 vues (au cours des 30 derniers jours)
peterhack
peterhack le 10 Nov 2016
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 == '?????',:)

Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by