Running Matlab 2014a 64 bit on Windows 7.
Occasionally, when trying to open .xls files using xlsread I get the error:
XLSREAD unable to open file '\\path\subpath\...\filename.xls'. File '\\path\subpath\...\filename.xls'' not found.
the strings I'm using for pathname and filename are generated by using uigetfile, so Matlab can obviously see the files, which I've double checked using the exist function. I'm able to get around the problem by manually opening the Excel files and then closing them (Excel always prompts if I want to save, despite me changing nothing in the file), after which xlsread is successfully able to load the files.
These are .xls files containing macros

Réponses (1)

Sean de Wolski
Sean de Wolski le 19 Déc 2014
Are you creating absolute full file paths with both outputs of uigetfile?
[FileName,PathName] = uigetfile()
fn = fullfile(PathName,FileName)
xlsread(fn)
Otherwise, it could be relative and not found if the current directory changes or similar.

Catégories

En savoir plus sur App Building dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by