The month function is only defined for certain data types in MATLAB. It can be used to extract the month number from a datetime array, in which case the first input must be a datetime array or a tall array containing datetime values. It is not defined for double arrays in MATLAB. There is a month function in Financial Toolbox for extracting the month from a serial date number or a date character vector. If that's what you're trying to call, confirm using ver that you have Financial Toolbox installed. Alternately, instead of operating on serial date numbers I encourage you to transition to using datetime arrays. If you're looking to get a variable representing one month of time, consider using calmonths instead. You can add a calendar month created with calmonths to a datetime and it will automatically handle months having different numbers of days.
T = datetime('today')
nextMonth = T + calmonths(1)
nextJanuary = T + calmonths(2)
Don't try to copy functions written by MathWorks to different locations. At best they might work, but at worst they could interfere with the operation of seemingly unrelated functions or put MATLAB in a bad state on startup by preventing the MATLAB search path from initializing correctly.
Best Answer