problem in read files
Show older comments
hello,
I read files , and take the first column from each file and append it with the other column of other file.
I read 50000 files
this is my code:
%%%%%%%%%%%%%%
targetdir = 'd:\matlab7\work\training_set';
targetfiles = '*.txt';
fileinfo = dir(fullfile(targetdir, targetfiles))
k=0;arr(:,:)=0; inc=0;k=0;y=1;c0=[];
for i = 1:50000
thisfilename = fullfile(targetdir, fileinfo(i).name);
f=fopen(thisfilename,'r');
c = textscan(f,'%f %f %s','Delimiter',',','headerLines',1);
fclose(f);
c1=sparse(length(c));c2=sparse(length(c1));c3=sparse(length(c));
c1=c{1}; c01=[ c0;c1];
s=sort(c01);
id_u=unique(s); c0=id_u;
clear c1
end
%%%%%%%%%
why I got this error when i=17771.
??? Index exceeds matrix dimensions.
Error in ==> movfile at 7
thisfilename = fullfile(targetdir, fileinfo(i).name);
Accepted Answer
More Answers (0)
Categories
Find more on Search Path in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!