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

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

    xxxxx...........

end

0 Comments

Hassaan

Products

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.

4 Comments

Walter Roberson on 30 Jan 2013

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

Hassaan on 30 Jan 2013

parfor fit_loop = 1 : Pop_size

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

end

Jason Ross on 30 Jan 2013

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

Walter Roberson

Contact us