필터 지우기
필터 지우기

Can't save new file even though I definitely have write permissions

조회 수: 93 (최근 30일)
I'm trying to save a .mat file in the following manner:
save('/path/to/file/file.mat','var1','var2');
I'm getting the "Cannot save /path/to/file/file.mat: Permission denied" that you typically get when the user running Matlab does not have permissions to write to the directory specified.
The problem is I ABSOLUTELY have write permissions to /path/to/file.
The output to
ls -l '/path/to/'
shows the 'file' directory as drwxrwxr-x, and belongs to group "Developers", which I am a part of.
Further proof that I have write permissions: If I cd /path/to/file/ and then create a file named 'file.mat' using vim, and THEN invoke Matlab's save as described above, it WORKS!. If I then remove that file using a terminal and try to save from Matlab again, it FAILS!
Why might I not be able to create a new file from Matlab?
The only nuance I can think of is /path/to/file is an NFS mount on RHEL7
  댓글 수: 2
Walter Roberson
Walter Roberson 2023년 12월 20일
I no longer recall... if /path/to/file is an NFS mount point, then does ls -l reflect the permissions of the underlying mount point, or does it reflect the permissions of the mounted filesystem ?
Daniel Klisiewicz
Daniel Klisiewicz 2023년 12월 21일
편집: Daniel Klisiewicz 2023년 12월 21일
given that I can can change the permissions of /path/to/file on the mounted location and have it reflect in the ls -l output, I'm led to believe that it reflects the underlying mount point and not the filesystem itself.
This is a good point to consider, although I'm not sure if it explains why I can create a file from a terminal at the mount point but not from an instance of matlab at the same location?

댓글을 달려면 로그인하십시오.

채택된 답변

Daniel Klisiewicz
Daniel Klisiewicz 2023년 12월 22일
It turns out that the Matlab session was launched prior to myself being added to the 'Developer' group. A log out, log in, and relaunch of Matlab fixed the issue.

추가 답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 12월 20일
Check the permission:
% Specify the path you want to check
folderPath = '/path/to/file/file.mat';
% Get file attributes
attributes = fileattrib(folderPath);
% Check if you have the write permission in the folder
if attributes==1
disp('Write permission is available for you! :)');
else
disp('Write permission is NOT available for you! :(');
end

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by