MATLAB Answers

Month function doesn't work with double anymore

4 views (last 30 days)
Eric Escoto
Eric Escoto on 27 Mar 2019
Commented: Star Strider on 27 Mar 2019
Hello,
I have just updated to 2019a. My scripts have worked previously 2018 version and now they do not. I am recieving an error message,
"Undefined function 'month' for input arguments of type 'double'." I have not made any changes to my scripts between matlab software version change.
Any idea what is happening?
Thanks,
Eric

  0 Comments

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 27 Mar 2019
From the documentation:
m = month(t) returns the month numbers of the datetime values in t. The m output contains integer values from 1 to 12.’
It appears only to work with datetime variables.

  2 Comments

Eric Escoto
Eric Escoto on 27 Mar 2019
Star,
I worked around by calling the datevec associated with the double array. Works perfectly now.
Thanks for the quick response!
-Eric
Star Strider
Star Strider on 27 Mar 2019
As always, my pleasure!
I was going to suggest using datevec if you’re working with datenum format variables.

Sign in to comment.

More Answers (0)

Sign in to answer this question.