Why parfor could read the deleted script?

2 ビュー (過去 30 日間)
Zhida DENG
Zhida DENG 2019 年 10 月 30 日
編集済み: Matt J 2019 年 10 月 31 日
Hi all,
I was debuging my algorithm and it was found that the "parfor loop" could read a deleted script (and this does not happening on "for loop" ). I guess that is because there is a script has same name as deleted script exist in other folders which I was added the path before (i cant delete the). I have tried restart Matlabt, shut-down the parallel pool, and used "restoredefaultpath" to resotre the default path, but these didn't solve my problem.
Does any one know how to resolve it?
Thanks in advance!!
Regards
zd
  1 件のコメント
Wiley Mosley
Wiley Mosley 2019 年 10 月 30 日
If you know where the path is to the script that you don't want then you could remove the path.
rmpath(FOLDERNAME)
If you really don't want to use it, then just comment out that call in the code. Hopefully the rmpath helps.

サインインしてコメントする。

採用された回答

Matt J
Matt J 2019 年 10 月 31 日
編集済み: Matt J 2019 年 10 月 31 日
Remember that in a parfor loop, you are responsible for ensuring that no operations in the loop that depend on the order of execution of the loop iterations - a parfor loop can decide to execute the loop iterations in any order it wishes, and you have no control over this. If you see a difference in behavior of for-loop and a parfor-loop, it is often because you have not met this condition.
A simple test is to run the loop as an ordinary for-loop, but randomize the order, and see if something funny happens:
for i=randperm(1:N)
....
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by