Effacer les filtres
Effacer les filtres

Why can't I load a .mat file from a shared network location?

16 vues (au cours des 30 derniers jours)
Ann Hickox
Ann Hickox le 30 Nov 2018
I wrote a script that loads data from "ai.mat". I use a loop to iterate through my data folders, and for each folder I cd() to the folder, load the second component of ai.mat, perform some calculations, then cd() back to the folder I operate out of (where the .m file is saved).
% load data from ai.mat
vars = whos('-file','ai.mat');
load('ai.mat',vars(2).name);
I have no trouble performing this routine when the data folders are on my local computer. However, when I try to perform the same routine on the same data folders that are copied to a shared network location, I am unable to load ai.mat even though Matlab thinks it exists (e.g. I can cd() to the shared folder, I see ai.mat when I type dir, and exist('ai.mat') returns 2). For reasons I won't go into, it's advantageous for me to be able to access the files from the shared location rather than my local computer. The shared location is mapped to my local machine as "Z:\". I get this error message: "Error using load: Cannot read file Z:\PATH\ai.mat."
Can anyone identify why I can't access these .mat files on the shared location? Thanks.

Réponses (2)

Harry Vancao
Harry Vancao le 5 Déc 2018
Modifié(e) : Harry Vancao le 5 Déc 2018
The most likely cause for this is that you may not have permissions to read these files. Please make sure that you have read access to the directory that ai.mat is located in.
  1 commentaire
Steven Lord
Steven Lord le 5 Déc 2018
Another possibility is that the ai.mat file in the network location has been corrupted or is a different type of file that happens to have the .mat extension. To test this possibility, if you copy the ai.mat file to a local temporary directory outside MATLAB (using Windows Explorer) can you load it from that temporary directory?
winopen Z:\PATH
winopen(tempdir)
cd(tempdir)
Copy the file then
load ai.mat

Connectez-vous pour commenter.


Jacob Smith
Jacob Smith le 13 Sep 2021
We've been having a similar issue and can confirm it's not because of the above answers. Strangely, using the 'edit file.m' function loads it fine, but otherwise it just cooks itself. Only happens on a shared network drive.
An answer to this would be fab as there is something real weird going on

Catégories

En savoir plus sur Search Path dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by