MATLAB Answers

Error using save Unable to write file datafiles/f01.mat: No such file or directory.

56 ビュー (過去 30 日間)
Kingsley Osime
Kingsley Osime 2011 年 7 月 1 日
コメント済み: Alessio 2018 年 7 月 31 日
keep getting this error for simple save function. heres my code
if (jrandflag == 1) o = jrand.createShiftVector(D, lb, ub); o = o'; save('datafiles/f01.mat', 'o'); else load('datafiles/f01.mat'); o = o(1:D); end
datafiles folder does exist in same directory; expect'd save function to create f01.mat but error every time. and code not in loop per se
Can anyone help please? Thanks
Matlab version (R2010a) on windows platform


Fangjun Jiang
Fangjun Jiang 2011 年 7 月 1 日
'datafiles/f01.mat' isn't the full path of the file, is it? If you mean to save it in the current folder, try.
  1 件のコメント
Kingsley Osime
Kingsley Osime 2011 年 7 月 1 日
yup.. fullfile definitely worked - Thanks!!


その他の回答 (1 件)

Bart Van Hove
Bart Van Hove 2018 年 1 月 12 日
When my MATLAB (2014b) has been running for a while (days), sometimes the current folder disappears from the path (have not verified if this is exactly what happens). Running scripts, functions, loading files... continues to work, but saving to subdir/file.mat does not. Moving up 1 directory in the MATLAB file browser and re-entering the current folder resolves the issue for me. Saving with a full path as suggested by Jiang avoids this issue, but I'm still curious why it occurs.
  1 件のコメント
Alessio 2018 年 7 月 31 日
I experienced the same issue with R2014b, and the workaround is the same. I'm curious if they fixed it on next versions.


Community Treasure Hunt

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

Start Hunting!

Translated by