repeated -append sometimes fails with permission denied

4 ビュー (過去 30 日間)
Ingrid
Ingrid 2016 年 2 月 19 日
コメント済み: Greg Allen 2016 年 4 月 4 日
in my code I have to save data repeatedly to the same mat.file so I am using the -append command. This works fine, however, sometimes I get a permission denied error saying that it cannot save. This seems to occur randomly (i.e. I have no idea when it will happen or after how many times). What can be causing this? I am only running one matlab instance and one function so the file should not be open anymore as the next line of code is only executed when the previous save is finished, no?
  1 件のコメント
Greg Allen
Greg Allen 2016 年 4 月 4 日
If you are on OS X or Linux, you should check the file permissions. Check the file permissions on the directory, also. Another application may be changing the file permissions, so try saving in a different place with a different name.

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

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2016 年 2 月 19 日
Use rehash after saving the file might solve this issue. From the help text of rehash:
The only time one should need to use this form is when writing out files programmatically and expecting MATLAB to find them before reaching the next MATLAB prompt.
  3 件のコメント
Ingrid
Ingrid 2016 年 2 月 29 日
thanks Walter, I also did not think the problem would be solved by this. I did however find the problem. I noticed it only happens when by accident I have the selection of the current folder to the mat file that I am currently trying to write to. Showing the details of this file in the matlab window apparently has as a consequence that the file is "busy" although I am not trying to open it so now I am paying attention not always just have a folder or something like that selected when running my code
Walter Roberson
Walter Roberson 2016 年 2 月 29 日
Ah, good sluthing, Ingrid.

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

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by