Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

`fopen` cannot create a binary file on NAS

조회 수: 1 (최근 30일)
Kouichi C. Nakamura
Kouichi C. Nakamura 2020년 12월 12일
마감: Kouichi C. Nakamura 2020년 12월 12일
I've been using fopen on a NAS regularly without a problem, but somehow I encounter a problem today, and fopen keeps failing to create a binary file.
fid = fopen(outfilename,'w');
fid =
-1
K>> outfilename
outfilename =
'\\nasdrive\.....\yyyyyy\xxxxxx.bin'
folder = fileparts(outfilename);
isfolder(folder)
ans =
logical
1
fileattrib(folder)
Name: '\\nasdrive\.....\yyyyyy'
archive: 0
system: 0
hidden: 0
directory: 1
UserRead: 1
UserWrite: 1
UserExecute: 1
GroupRead: NaN
GroupWrite: NaN
GroupExecute: NaN
OtherRead: NaN
OtherWrite: NaN
OtherExecute: NaN
Apparently, the folder exists and I have write access to the folder (UserWrite = 1), but I cannot create a file (fid = -1). The file name (2020-11-09_12-09-41_snr1a_01_iron.bin) doesn't contain illegal letters.
For comparision, I tried save and it doesn't work either.
save(fullfile('\\nasdrive\.....\yyyyyy','temp.mat'),'args')
Error using save
Unable to write file \\nasdrive\.....\yyyyyy\temp.mat: permission denied.
I'm using MATLAB R2020b and Windows 10.
Does anyone has a clue of how to fix this issue??? Why I cannot write a file even though UserWrite = 1? I have another folder on the same NAS, which has the same output for fileattrib, and fopen works in that folder.
  댓글 수: 3
Image Analyst
Image Analyst 2020년 12월 12일
Looks like a permission issue rather than a MATLAB issue. Can you use File Explorer and right click in that folder and say "New => text document"? Does that work?
Kouichi C. Nakamura
Kouichi C. Nakamura 2020년 12월 12일
Uh, thanks! Now I figured out where I made a mistake! I've confused the two drives one of which is read-only and the another with write access. It was a simple human error. Not a MATLAB issue after all.

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by