unable to write file permission denied

I'm trying to put an output by using:
save expr.txt t expr_at_i -ascii how can I allow the permission
Unable to write file expr.txt: permission denied

2 Comments

we also have this problem
As described below, you are in a directory that you do not have write access to.

Sign in to comment.

 Accepted Answer

Torsten
Torsten on 30 May 2021
Edited: Walter Roberson on 30 May 2021
After starting Matlab, type in the command window "cd" followed by a folder where you have writing permission.
See
for more details.

8 Comments

Thank you so much sir but how can I know that i have writing permission in a folder ,because I tried cd in another folder I found the same error ,I'm sorry I'm really new to these things
thnk you so much I have fixed the issue I have started my matlab as an admin and it worked!!
dirname = 'NameOfDirectoryGoesHere';
if exists(dirname, 'dir')
[status, attr] = fileattrib();
if status && attr.UserWrite
fprintf('Yes, you have write access to directory "%s"', dirname);
else
fprintf('No, no write access to "%s"');
end
else
fprintf('"%s" is not directory', dirname);
end
You would usually have write access to the directory named by userpath()
cd(userpath())
Torsten
Torsten on 30 May 2021
Edited: Torsten on 30 May 2021
What drives are available on the computer you could change to apart from the C drive ?
Often, if you don't work on your own computer, users are not allowed to write to the C drive.
The easiest way to find out whether you have write permission in a directory is to edit a file and try to save it in the respective directory.
You would not normally be permitted to write into a folder under the MATLAB installation directory: this is something enforced by the operating system.
But be careful now as Admin that you don't overwrite important files.
Better change to a drive different from the C drive and create your working folder there.

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!