MATLAB Answers


How can I troubleshoot this in my code 'The process cannot access the file because it is being used by another process.'

Asked by Hassaan
on 29 Jan 2013

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




Log in to comment.


No products are associated with this question.

1 Answer

Answer by Walter Roberson
on 29 Jan 2013
 Accepted 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.


Show 1 older comment

Please show the code, and also indicate which line the error is being generated against.

parfor fit_loop = 1 : Pop_size

    system(['$eclipse ' 'MainFile30x30x3(' int2str(fit_loop) ')'])


Are you assuming that the iterations are executed in order in your code? parfor does not guarantee the order in which iterations are executed.

Log in to comment.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!