matlab读取excel时间数据后,截取年份时出错
[~,~,raw]=xlsread('C:\Users\ThinkPad\OneDrive\FOF\latestmatlab\NV.xlsx','类型_4');%读取的e...
[~,~,raw]=xlsread('C:\Users\ThinkPad\OneDrive\FOF\latest matlab\NV.xlsx','类型_4');
%读取的excel文件中第一列是时间,后面几列是指数数据
raw = raw(2:end,:);
ID = year(raw(:,1))*12;
就在这个取 year的时候,提示:
Error using datevec (line 103)
The input to DATEVEC was not an array of strings.
Error in year (line 37)
c = datevec(d(:));
Error in year_return (line 4)
ID = year(raw(:,1))*12; 展开
%读取的excel文件中第一列是时间,后面几列是指数数据
raw = raw(2:end,:);
ID = year(raw(:,1))*12;
就在这个取 year的时候,提示:
Error using datevec (line 103)
The input to DATEVEC was not an array of strings.
Error in year (line 37)
c = datevec(d(:));
Error in year_return (line 4)
ID = year(raw(:,1))*12; 展开
1个回答
展开全部
更多追问追答
追问
matlab能读出来,但是是cell ,datevec只能读char的,我现在在外面,等会儿回去试试你说的方法吧~
追答
你确定第一咧读出来了吗?cell有可能是其他列的数据吧,我的机器上没有读出来耶!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询