Bozmaje
Bozmaje

Reputation: 75

Extract data from table based on a month- How to?

I have a table, I want to know how to have only January data from all years (only January from all years (1989-2018))? I tried this:

mytable_Jan = mytable(mytable.date == "Jan", :);

But not working, the error is:

Unable to convert the text 'Jan' to a datetime value because its format was not recognized.

The table is attached Thanks

Upvotes: 1

Views: 76

Answers (1)

Rotem
Rotem

Reputation: 32084

The correct syntax is to use month(mytable.date):

mytable_Jan = mytable(month(mytable.date) == 1, :)

Upvotes: 2

Related Questions