Borrar filtros
Borrar filtros

convert DateString in cell array

2 visualizaciones (últimos 30 días)
Maximilian comploj
Maximilian comploj el 20 de Oct. de 2016
Respondida: Star Strider el 20 de Oct. de 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 :)

Respuestas (1)

Star Strider
Star Strider el 20 de Oct. de 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).

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by