You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
Why do I receive the error message "Error using load Unable to read file Permission denied"
7 views (last 30 days)
Show older comments
I have a function which use Load and once in two I have this error message. I don't understand why. Can someone help me ?
16 Comments
Adam Danz
on 3 Apr 2019
If you google "matlab Error using load Unable to read file Permission denied" there are lots of suggestions. Do you have a unique problem not addressed before?
Adam Danz
on 3 Apr 2019
Can you list the potential problems you've ruled out so far so we know where to start?
Gaëlle Sandront
on 3 Apr 2019
I try to run matlab as an administrator, I did 'clear all' and they restart matlab but it also didn't work. I also try to change the permission. Maybe they other other possiblilities but i didn't find.
Walter Roberson
on 3 Apr 2019
Are you using MS Windows? If you are then is it possible that the file you are trying to read is in use in another program?
Adam Danz
on 3 Apr 2019
Is the file a mat file? If yes, does it load when you grad-and-drop it into the workspace? Perhaps the file is corrupt.
Gaëlle Sandront
on 3 Apr 2019
What do you means by MS Windows ? I use windows 10 and I don't think so.
Yes it load.
Adam Danz
on 3 Apr 2019
MS windows mean Microsoft Windows.
So it's a mat file and you can drag-n-drop but you can't us load().
Are you specifying the full file name inlcuding the path?
Can you show us the lines of code?
Gaëlle Sandront
on 3 Apr 2019
Edited: Gaëlle Sandront
on 3 Apr 2019
I have in one function
Rii = psi_Rd(a);
Lii = psi_Ld(a);
filename = 'psidQ40.mat';
save(filename,'Rii', 'Lii')
and in an other one
load ('psidQ40.mat', 'Rii', 'Lii')
ant the 'a' is variable
Adam Danz
on 3 Apr 2019
What happens when you specify the full path?
path = 'C:\Users\name\Documents\MATLAB'; % <-- path to your mat file
filename = 'psidQ40.mat'; % <-- exact name of your mat file
load(fullfile(path, filename), 'Rii', 'Lii')
Walter Roberson
on 5 Apr 2019
Knowing the content of the file will not help for permission problems.
Permission problems can be due to security settings on the file, such as if the file was owned by a different user and you did not have authority to read the file. Those kinds of permission problems are a constant fact of life in a multiuser Unix setting, difficult to escape. They are also a factor in Window Server systems. In individual Windows systems, these kinds of permission problems are typically only noticed in the question of whether you have administrator rights to install or write new files underneath the Windows executable directories.
On MS Windows systems, permission problems can also show up if a file is already open when you try to use it. Unix distinguishes this situation from the "no permission" situation, returning an EBUSY or EAGAIN error instead of a EACCESS error.
Both Unix and MS Windows implement two kinds of locks: "advisory locks" and "mandatory locks". But (A) It is common on for MS Windows to make a mistake and enforce a mandatory lock in a situation that should be advisory; and (B) MS Windows applications that do not request shared access are automatically granted full mandatory exclusive access. Either way, it is common in MS Windows to end up in a situation in which one process opened a file, and no other process can read or write the same file until the first process closes the file. So if I ask to "read" a file in MS Windows, and I forget to say that other processes can have access to, then no other process can read or write the file until I remember to close the file or my process ends. By way of contrast: if I naively open a file for reading on Unix, and I do not remember to ask if anyone is writing to the file, then I can end up reading inconsistent content in the file. Both approaches have their advantages and disadvantages, but the MS Windows approach is a lot more likely to lock everyone out of a file that multiple processes are simply wanting to read.
Answers (0)
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)