I am trying to use parfor in order to speed up the reading of 1000 ascii files. Each file is in the following format:
- 10 lines describing the data and is the header of the file.
- the rest of the lines are in the format '%f %f %f %f' containing the values of x, y, z1, z2 variables. The number of these data are up to 10000.
x and y represents the rectangular domain in which z1 and z2 has been measured. Therefore, the domain remains the same among 1000 files. I want to use parfor and store one vector 10000×1 for x, one vector 10000×1 for y, one array 10000×1000 for z1 and one array 10000×1000 for z2.
I used the following pseudocode:
data=textscan(fid,'%f %f %f %f','HeaderLines',10);
I get the error "The variable z1 in a parfor cannot be classified". The error may arise from the indices which are restricted in parfor loop.
Is there a better way for reading these 1000 files in parallel?