Filter löschen
Filter löschen

convert DateString in cell array

2 Ansichten (letzte 30 Tage)
Maximilian comploj
Maximilian comploj am 20 Okt. 2016
Beantwortet: Star Strider am 20 Okt. 2016
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 :)

Antworten (1)

Star Strider
Star Strider am 20 Okt. 2016
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).

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by