I have about 600 data files that I need to extract a few variables from and manipulate. They are titled "experiment-n.m" where n is a number ranging from 1-900. I already have the code to manipulate them, but I was hoping to find an easier way to read in these files than individually. The hard part is that the numbering is rather sporadic, and can be experiment-200 than skip to experiment-697.
I was considering making a for loop along the lines of:
for step = 1:900
str = sprintf('experiment-%d',step)
force = load(str,magf);
area = load(str, fn_area);
I have yet to test this code so there may be some errors in it. However, this would not work with the data due to skipping experiment numbers (like I said, the files will be experiments 1-100, skip to 150, skip to 257, etc.)
Is there some way to have this code process an error received when the file name is not found and make it skip to the next file name?