Need help with datenum function
Mostrar comentarios más antiguos
I'm using Matlab R2015b. I have "date" variable ( 178x1 cell ) inside a struct named "data". It consists of one column with multiple rows that consists of dates in dd/mm/yyyy format. Now I'm trying to convert them into numbers using datenum command,
dates = datenum(data.date, 'dd/mm/yyyy');
but it returns me with error.. What am I doing wrong? I've attached a screenshot of what the data looks like. Thanks in advance.
1 comentario
Adhi Ariawan
el 29 de Nov. de 2017
Respuesta aceptada
Más respuestas (1)
Peter Perkins
el 29 de Nov. de 2017
If you have R2015b, you will likely be happioer using datetimes rather than datenums:
dates = datetime(data.date(2:end),'Format','dd/mm/yyyy')
You may also want to use a table, rather than a scalar struct, but hard to say without seeing more.
Categorías
Más información sobre Time Series Objects en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!