I am reading a large number of data from say, 100 csv files using csvread. But some of these files (say 10) have nonnumeric values/characters etc. which cannot be read by csvread. This gives an error and stops the code. I do not necessaruly need those faulty files. How can I ask MATLAB to, if encountered such an error, ignore that whole file and continue reading the rest? So for example if file number 12 is faulty, the file 13 will be read as 12 and so on?
This is the error for reading the faulty files:
"Mismatch between file and format character vector. Trouble reading 'Numeric' field from file ......"
and this is the loop:
for i = 1: 100
fileID = sprintf([FileName,'_%02d.csv'], i);
M = csvread(fileID,3,0);