3

When I interrupt a script in the middle of a parfor, some files are still opened by Matlab (e.g. I cannot delete them). I usually call flcose('all') to close all open files but it doesn't seem work in this case. What should I do?

4

1 回答 1

2

那是因为parfor创建了一堆拥有自己文件句柄的 Matlab 从站。两个主要的解决方案是:

parfor i=1:12 % 12 or some number over your number of workers
   fclose('all')
end

或者简单地使用matlabpool close或 GUI(左下角)关闭并行池:

在此处输入图像描述

请注意,您可以使用Process Explorer来查找在 Windows 中打开文件的进程:

在此处输入图像描述

于 2014-06-15T17:11:00.550 回答