Problem with xlsread when opening Excel files at network folder. (R2015a, Windows 7 64bits). Opening & saving files with Excel solves problem. WTF?!?
Mostra commenti meno recenti
Hello,
We are working with a standalone matlab app we have created using R2015a in Windows 7 Enterprise (64bits). Since last week we have a problem with the app, and the line that produces the error is:
[Datos_Med, Texto_Med, ~] = xlsread(file_med,'Hoja1');
where 'Hoja1' is the sheet name (it's ok) and file_med is a char array (1x122) with value:
'\\almcommit.set.umi.net\vai\vaitratado\LINEA AEREA\Datos de auscultaciones\Mediciones VAI\L6\Datos OHL L6 V1 20120625.xlsm'
This is the error we get:
Error using xlsread (line 128) XLSREAD unable to open file '\\almcommit.set.umi.net\vai\vaitratado\LINEA AEREA\Datos de auscultaciones\Mediciones VAI\L6\Datos OHL L6 V1 20120625.xlsm'. File '\\almcommit.set.umi.net\vai\vaitratado\LINEA AEREA\Datos de auscultaciones\Mediciones VAI\L6\Datos OHL L6 V1 20120625.xlsm' not found.
This Excel file (an example) contains some data we want to save into a matlab table in order to analyze it. Obviously all these files exist, now and a week before, and they can be opened by Excel app and founded into their location in Windows (a network folder). There is no error inside them, and they weren't modified recently. This line also produce the same error when we run it from Matlab environment, so we can assume it isn't a app error.
The most strange thing about this problem is that when we open any of this files with Excel app, and we save them without doing any change, then xlsread works perfectly with these re-saved files. ¿¿??
We have contact with IT department in order to get detail about files permissions, and they report that all these files have the same properties. A solution could be manually open and save all of them, or use an app to do it automatically, but we would like to know the reason this line is returning that error...
Any idea?
Thanks in advance.
2 Commenti
Raul
il 31 Lug 2015
Risposte (2)
Sudhanshu Bhatt
il 4 Ago 2015
Modificato: Sudhanshu Bhatt
il 4 Ago 2015
Hi Raul,
Since " xlsread " is working intermittently , one possible reason could be connectivity issues while working with a network drive. To check that, you can try loading other files on the network using "xlsread" function and see if you get the same error while reading other excel files?
Also, to make sure the path to the file is correct, you can use " uigetfile " function in MATLAB, which will open a dialog box, where you can browse to the location where the Excel sheet is present and load it.
For Example:
Step 1: Find the file and get it's path:
>> [FileName,PathName,FilterIndex] = uigetfile();
>> fullAddress = strcat(PathName,FileName);
Step 2: Use the path obtained and pass it to xlsread function:
>> sheetname = 'NameAge';
>> test = xlsread(fullAddress,sheetname);
Note: "xlsread" while working with protected excel files may require 'basic' option. More information on "xlsread" can be found in the documentation link below:
Another way to open a file is to use " fopen " function in MATLAB, which will return a value greater than or equal to 3 if it can open the excel file. This way we can test if the problem is with "xlsread" or with accessing the file on network drive.
For Example:
>> fileId = fopen(fullAddress);
More information on "uigetfile" and "fopen" can be found in the documentation links below:
If this does not resolve the issue, then you can contact MathWorks Technical Support by creating a case using the link below:
I am attaching a code snippet to read an excel file using "uigetfile" and "xlsread".
Hope this helps.
Thanks
Sudhanshu Bhatt
1 Commento
Giulio Francesca
il 28 Lug 2018
0 voti
Hi Raul, I've got th same issue... how did you manage that?
Thank you
Categorie
Scopri di più su Matrix Indexing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!