Fix for " The input to DATENUM was not an array of strings."
Mostrar comentarios más antiguos
I am attempting to use datenum on my table (one column, first column) of dates to convert it into a separate variable of just a series of numbers
dataset = readtable('equity_dataset_30.csv');
data = dataset(:,2:31);
date = dataset(:,1);
date_num = datenum(date, 'yyyy-mm-dd');
This last line keeps returning the error: " The input to DATENUM was not an array of strings."
Could someone show what I'm missing here?
Respuesta aceptada
Más respuestas (1)
Massimo Zanetti
el 7 de Oct. de 2016
3 votos
Most probably your variable "date" is not an array of strings.
7 comentarios
NN
el 25 de Oct. de 2020
kindly see the below code .i also get the same error.kindly advice
%reading date
Data=readtable('2019_SysLoad.xlsx');
save 2019_SysLoad.mat Data
testdates=Data((5834:end),1)};
testdates1=datenum(testdates1,'mm-dd-yyyy');
Walter Roberson
el 25 de Oct. de 2020
testdates = Data{5834:end,1)};
NN
el 25 de Oct. de 2020
thank you .But it gives the following error
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for
mismatched delimiters.
Walter Roberson
el 25 de Oct. de 2020
testdates = Data{5834:end,1};
NN
el 26 de Oct. de 2020
thank you .It worked.
But i am getting spike like output when i plot datenum and forecasted output.Doesnt look lik wave form .
Kindly advice

Walter Roberson
el 26 de Oct. de 2020
I do not see any obvious problem with the plot. It looks to me like what you would expect for a plot displayed with an unfortunate aspect ratio. Try zooming it.
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!