Matlab can't find files using xlsread
Show older comments
Hi,
I'm using a MATLAB script to compile a massive amount of .csv files into one. The script works fine and has run successfully before, but I am having major problems with xlsread returning error messages similar to the following. (I replaced the foldername and filename because they are a little long and also contain some sensitive info)
XLSREAD unable to open file
'C:\Output\foldername\filename.csv'
File
'C:\Output\foldername\filename.csv'
not found.
I have tried adding the folder to the MATLAB path, but afterward I still get this message and also get error messages using excel with a similar file not found. I was wondering if it was a MATLAB problem or another issue.
Using the exist function before returns a nonzero number, but after adding to the path returns 0. Additionally, moving the files to a different directory for some reason allows excel to open the files, but still not matlab.
I am running MATLAB R2014a on a Windows XP Profesional Version 2002 Service Pack 3 using Excel 2010.
EDIT: It turns out there is actually a maximum allowable pathlength in windows, which is around 260. I found 220, but that just might be my version or system.
3 Comments
Allen
on 27 Jun 2014
Image Analyst
on 12 Jul 2014
Just ran into this issue and resolved it in a very strange way. Moved the .m script file and the excel spread sheet to a different directory and tried to run the script. matlab said something about path and i added the path. then i added both files back to the original directory and added the path again and it worked.
Accepted Answer
More Answers (0)
Categories
Find more on Data Import from MATLAB 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!