MATLAB: Convert year into Matlab date format

date

How can I convert the year into the matlab date format if I have a big data set? I have a table:
Year Data
1999
2000
2001 …

Best Answer

If you have a numeric vector containing year numbers, you can convert a vector into a datetime array object as follow
myVector = 2000:2010
datetime(string(myVector), 'Format', 'yyyy')