Error writing name_file.m. Access denied.

Hi everyone, I have a sudden problem when I try to save or run the file. The error window say "Error writing name_file.m. Access denied". It's really strange because it has always worked well. I tryed to:
  • Change path location
  • Open Matlab as administrator
  • Change Matlab version from 2016 to 2018
  • Change Matlab file
But i have always the same problem. I can not understand what the problem could be. This is the screenshot:

6 件のコメント

Geoff Hayes
Geoff Hayes 2019 年 2 月 15 日
michele - is it only this file that is causing the problem or is it others? have you tried saving the file to a different folder? what are the permissions on the file (read only or read/write)?
michele paoletti
michele paoletti 2019 年 2 月 15 日
All files give me the same problem, i tried to save in a different folder (and give me another error) and permission are read and write.
Brent Vanhul
Brent Vanhul 2019 年 2 月 18 日
編集済み: Brent Vanhul 2019 年 2 月 18 日
I have exactly the same error message and tried the same as listed. I firstly encountered the problem 11 Feb 2019 and now I'am not able to write to,save or create any file/folder anywhere on my C drive by using matlab (Windows 10 Version 1803).
pwd: 'C:\Users\vanhu\Documents\MATLAB\...'
Matlab installed: 'C:\Program Files\MATLAB\R2018b'
I checked the permissions for all the different groups and users for the pwd and everyone has: modify, read & execute, list folder contents, read, write.
michele paoletti
michele paoletti 2019 年 2 月 18 日
Hi Brent, i have encountered the problem in the same period, i have Windows 10 Home Version 1803.
Mehul Mulay
Mehul Mulay 2021 年 9 月 27 日
Hi!
I have faced a similar problem on MacOS.
Please let me know the solution..
Andy Mendez Cuello
Andy Mendez Cuello 2022 年 9 月 15 日
Hi.
I have a Windows 10 Pro, I had the same problem and in the end it was for safety issues for applications control, I gave him to allow change in Matlab and I stopped giving me that mistake.
Greetings.

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

 採用された回答

michele paoletti
michele paoletti 2019 年 2 月 18 日
編集済み: michele paoletti 2019 年 2 月 18 日

3 投票

I solved the problem installing Matlab R2018b and going in C:\Program Files\MATLAB\ , add privileges access to the group called packet application:
But using Matlab R2016b the problem remain. I use now the new version to avoid this problem.

3 件のコメント

Brent Vanhul
Brent Vanhul 2019 年 2 月 18 日
Thanks a lot, this fixed it!! I changed the security settings for the package application, and I also had to exclude Matlab from windows defender.
michele paoletti
michele paoletti 2019 年 2 月 19 日
Very good, you're welcome!
karthikeya anil kumar
karthikeya anil kumar 2019 年 3 月 9 日
yeah, thats the correct way of solving error, or even some times we need to change the secutity settings of a entire drive or for folders in which you are trying to save the (.m) MATLAB FILE.Capture.PNG

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

その他の回答 (3 件)

Supratim Shit
Supratim Shit 2019 年 5 月 9 日

10 投票

You are facing this issue becasue of a feature called controlled folder access in Windows 10. It helps you protect valuable data from malicious apps and threats, such as ransomware.
You need to go to Settings > Update & Security > Windows Security > Virus and Threat protection > Manage Ransomware Protection > Allow an app through controlled folder access > Add your application

10 件のコメント

Jaisal Chauhan
Jaisal Chauhan 2020 年 3 月 27 日
編集済み: Jaisal Chauhan 2020 年 3 月 27 日
thank you, man! You have saved my life with this answer, because I was able to save my experimetal results at the last moment for a project that i had to submit!
I don't know how you found out such a detailed intricate reason behind the issue, but kudos!
Hassan Kianmehr
Hassan Kianmehr 2020 年 7 月 17 日
Just login to say thank you!
Mehdi Hatami
Mehdi Hatami 2020 年 8 月 19 日
Thank you man For this great and valuable help you have given me!
Zhao Lu
Zhao Lu 2021 年 3 月 1 日
Very great and valuable answer !!
yagmur gedik
yagmur gedik 2021 年 3 月 2 日
thank you very much
Brijesh Shah
Brijesh Shah 2021 年 8 月 16 日
Thank you very much
shubhashree bal
shubhashree bal 2021 年 8 月 20 日
This worked.
Thank you!
FELIPE ANANGANÓ LEIME
FELIPE ANANGANÓ LEIME 2022 年 1 月 13 日
perfect, thank you!!!
Kevin Tapia Pantoja
Kevin Tapia Pantoja 2022 年 8 月 4 日
This is the right answer, I was working well until I activated the Ransomware protection but I just didn't allow Matlab. Thank you
johnny ramone
johnny ramone 2023 年 6 月 30 日
After almost a year sundelly the Ransomware protection blocked matlab, just go to recently block app and allow it. Thank you <3

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

Pruthvi Muppavarapu
Pruthvi Muppavarapu 2019 年 2 月 18 日

1 投票

Disabling the anti-virus might help resolve the issue.
If you are using Windows Defender; an exclusion may need to be made for MATLAB. This can be done in Windows 10 by following the steps mentioned in the link:
Pratibha Dimri
Pratibha Dimri 2021 年 5 月 24 日

0 投票

what worked for me was :
first go to search bar on windows-type matlab-run as admin

カテゴリ

ヘルプ センター および File ExchangeShare and Distribute Software についてさらに検索

製品

リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by