Caught "std::exception" Exception message is: Error open a file stream for write.

5 ビュー (過去 30 日間)
Giuseppe Galeone
Giuseppe Galeone 2022 年 2 月 12 日
コメント済み: Giuseppe Galeone 2022 年 2 月 14 日
I'm receiving this error with Matlab 2021b installed on a physical server, the same version of matlab on a different server is working fine. A way to consistently reproduce the issue is deleting directly a large amount of files without recycling them. I've already tried to uninstall, clean the Roaming directory and install back the Matlab.
  2 件のコメント
Image Analyst
Image Analyst 2022 年 2 月 12 日
Why are you calling fwrite()? What did you do? Just call the delete() function with "recycle off"? Do you have permisson on that server to do the deleting?
Giuseppe Galeone
Giuseppe Galeone 2022 年 2 月 12 日
Actually i'm not calling fwrite. This is the snippet:
err = [];
try
D = dir(sprintf('%s*_%s.json',DIR_JSON,environment_text));
if (~isempty(D))
for i=1:length(D)
if (mjuliandate(D(i).date) < (mjuliandate(now) - OUTPUT_MAX_DAYS))
filename = sprintf('%s%s',DIR_JSON,D(i).name);
%recycle off;
delete(filename);
%recycle on;
end
end
disp_now(sprintf('*** DIRECTORY "%s" CLEANED',DIR_JSON));
end
catch err
end
If i don't comment the recycle off and on the issue occurs. Yes i have all the privileges. This happens when the directory contains a large number of files.

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

回答 (1 件)

Image Analyst
Image Analyst 2022 年 2 月 12 日
Maybe try putting in
pause(0.2);
in case it's a timing issue.
  1 件のコメント
Giuseppe Galeone
Giuseppe Galeone 2022 年 2 月 14 日
Tried but this doesn't solve the issue. I rolled back to 2020b version and issue is not there, so it seems something specific of 2021a and 2021b version.

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

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by