If either condition is false, for any row, then datestr interprets the m-by-6 matrix as m-
by-6 serial date numbers.
Usually, dates with years in the range 1700–2300 are interpreted as date vectors.
However, datestr might interpret rows with month, day, hour, minute, or second values
outside their normal ranges as serial date numbers. For example, datestr correctly
interprets the following date vector for the year 2014:
datestr([2014 06 21 10 51 00])
ans =
21-Jun-2014 10:51:00
But given a day value outside the typical range (1–31), datestr returns a date for each
element of the vector:
datestr([2014 06 2110 10 51 00])
ans =
06-Jul-0005
06-Jan-0000
10-Oct-0005
10-Jan-0000
20-Feb-0000
00-Jan-0000
When you have a matrix of date vectors that datestr might interpret incorrectly as
serial date numbers, first convert the matrix to serial date numbers using datenum. Then,
use datestr to convert the date numbers.
When you have a matrix of serial date numbers that datestr might interpret as date
vectors, first convert the matrix to a column vector. Then, use datestr to convert the
column vector.
Converting Date Vector Returns Unexpected Output