MATLAB: How to split a cell into a year and a month

delimiterhow to split a cell into a year and a month?split

Hello to All, Could you please help me in splitting a cell, e.g. 192608, into 1926.08 or 1926/08? Such that I have a vector of date rows of the 'year.mm' format.
Thank you so much.
Cheers, Tamar

Best Answer

>> c=192608; % numeric
>> datestr(datenum(fix(c/100),rem(c,100),1),'YYYY.mm')
ans =
1926.08
>> cc='192608'; % character string
>> datestr(datenum(cc,'YYYYmm'),'YYYY.mm')
ans =
1926.08
>>