MATLAB: Use the same function for multiple cells in a row.

datetime from datenum

hi,
i want to calculate datetime from datenum, i do know for a single cell, how can i do it for the data of 50000 datenum by creating individual column with date and time…
its urgent please reply asap..

Best Answer

These all work:
dnv = datenum(now) + (0:10).'; % Numeric Array
dt1 = datetime(dnv, 'ConvertFrom','datenum')
dnc = num2cell(dnv); % Cell Array
dt2 = datetime([dnc{:}].', 'ConvertFrom','datenum')
dt3 = datetime(cell2mat(dnc), 'ConvertFrom','datenum')
Choose the one that you like best.