Month function doesn't work with double anymore

조회 수: 2 (최근 30일)
Eric Escoto
Eric Escoto 2019년 3월 27일
댓글: Star Strider 2019년 3월 27일
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?

채택된 답변

Star Strider
Star Strider 2019년 3월 27일
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
Eric Escoto
Eric Escoto 2019년 3월 27일
I worked around by calling the datevec associated with the double array. Works perfectly now.
Thanks for the quick response!
Star Strider
Star Strider 2019년 3월 27일
As always, my pleasure!
I was going to suggest using datevec if you’re working with datenum format variables.

댓글을 달려면 로그인하십시오.

추가 답변 (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