フィルターのクリア

convert DateString in cell array

1 回表示 (過去 30 日間)
Maximilian comploj
Maximilian comploj 2016 年 10 月 20 日
回答済み: Star Strider 2016 年 10 月 20 日
Hello I have a cell array 3x2
A = [5] '09/16/2007'
[2] '05/14/1996'
[3] '11/29/2010'
I would like to convert the Date from String to a usable format I can do it with
datevec(DateString,formatOut)
but lastly Matlab doesnt accept the new double for my cell array can someone help pls :)

回答 (1 件)

Star Strider
Star Strider 2016 年 10 月 20 日
This works for me:
A = {[5] '09/16/2007'
[2] '05/14/1996'
[3] '11/29/2010'};
dn = datenum(A(:,2), 'mm/dd/yyyy'); % Date Numbers
check = datevec(dn); % Check Conversion (Delete This Line Later)
You need to only use the second column of ‘A’ for the dates. The datenum function does not know what to do with the first column (and neither do I).

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by