Fix for " The input to DATENUM was not an array of strings."
이전 댓글 표시
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?
채택된 답변
추가 답변 (1개)
Massimo Zanetti
2016년 10월 7일
3 개 추천
Most probably your variable "date" is not an array of strings.
댓글 수: 7
NN
2020년 10월 25일
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
2020년 10월 25일
testdates = Data{5834:end,1)};
NN
2020년 10월 25일
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
2020년 10월 25일
testdates = Data{5834:end,1};
NN
2020년 10월 26일
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
2020년 10월 26일
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.
카테고리
도움말 센터 및 File Exchange에서 Time Series Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!