converion of a date

3 次查看(过去 30 天)
AA
AA 2015-9-25
hi, how can i convert this date Thu, Sep-24-15 to a serial date number.
thanks

采纳的回答

Star Strider
Star Strider 2015-9-26
This should work:
date_num = cellfun(@(x)datenum(x, 'ddd, mmm-DD-YY'), check123);
  2 个评论
AA
AA 2015-9-26
cellfun(@(x)datenum(x, 'ddd, mmm-DD-YY'), check123(~cellfun('isempty',check123)));
with empty lines u can use the above, thanks bro

请先登录,再进行评论。

更多回答(2 个)

Walter Roberson
Walter Roberson 2015-9-25
datenum('Thu, Sep-24-15', 'ddd, mmm-DD-YY')

AA
AA 2015-9-26
i used this code
>> date_num = cellfun(@datenum, check123, 'ddd, mmm-DD-YY');
check 123 is a cell array with one column of the dates in the format 'ddd, mmm-DD-YY'. I get the error message Input #3 expected to be a cell array, was char instead.
how can i correct this error?

类别

Help CenterFile Exchange 中查找有关 Dates and Time 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by