菜鸟求助!!MATLAB错误 Index exceeds matrix dimensions.
j=1;
[filename,filepath]=uigetfile('*.txt','Select Input file');
file = [filepath,filename];
fid = fopen(file,'rt');
if fid == -1
('Error opening the file')
end
while 1
nextline = fgetl(fid); %读第一行
DAY= nextline(1:2)
D(i)=str2num(DAY)
MONTH = nextline(4:6)
j=j+1;
if ~isstr(nextline), break, end %读到最后跳出
end
打开的文件内容为 20 Oct 2008
读数据正确 但总是出现错误提示:
??? Index exceeds matrix dimensions.
Error in ==> xishu at 10
DAY= nextline(1:2)
到底是为么事??