MATLAB: How to troubleshoot this in the code ‘The process cannot access the file because it is being used by another process.’

matlabpoolparfor

I am using matlabpool command to run some txt files from one software using parfor command. The problem here is that I am receiving this error 'The process cannot access the file because it is being used by another process'
Can someone guide me on this that what should i change in my code to avoid this error.
parfor i = 1 : N
xxxxx...........
end

Best Answer

It sounds as if you might have different iterations of the loop attempting to write to the same output file. You need to use different output files for the different iterations.