MATLAB loses track of directories/functions in the middle of a loop

2 ビュー (過去 30 日間)
Yiling
Yiling 2023 年 6 月 1 日
コメント済み: Yiling 2023 年 6 月 2 日
Hi everyone, I'm running a global optimization using Simulated Annealing and I've been running into an issue where, when I run the program it'll get through most of one iteration, or even most of the second iteration (after a successful first iteration) and then randomly lose track of an available directory or function that it had no problem accessing before. It always breaks at a different point within the iteration, and I check the paths that it's struggling with and they work perfectly fine. I've tried the optimization with a smaller dataset, with different MaxIterations limits, and it doesn't have this problem. Only with the full dataset (it takes about 5 hours to run one iteration) does it struggle with this. Any help would be appreciated!

回答 (1 件)

Image Analyst
Image Analyst 2023 年 6 月 1 日
It's hard to guess without any code. Are you sure you're providing the entire complete path to whatever function needs the folder or filename? Are you sure there is no call to cd() anywhere in your code?
See the FAQ:
  8 件のコメント
Stephen23
Stephen23 2023 年 6 月 2 日
編集済み: Stephen23 2023 年 6 月 2 日
"there are addpath(genpath()) commands."
That is quite possibly related: if folders are being added to the path, there might be some race condition occurring.
It is unusual to have the need to add all folders under MATLABROOT/TOOLBOX. Something fishy there.
Yiling
Yiling 2023 年 6 月 2 日
Thank you both, I'll add an error message when it occurs again.

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

カテゴリ

Help Center および File ExchangeSimulated Annealing についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by