xlsread on Mac not working

I use xlsread all the time on Windows, but it's not working on my Mac. Here is the line of code that doesn't work:
xlsread('/Users/dustyn/Dropbox/NYU-Poly/research/001 Robotic Metabolism/2 DOF Arm/experiment/Simple Arm Experiments.xls');
no matter what I do - change the direction of slashes, make it a .xlsx file or not, put a leading / or not - i get this error:
Error using xlsread (line 129) XLSREAD unable to open file '/Users/dustyn/Dropbox/NYU-Poly/research/001 Robotic Metabolism/2 DOF Arm/experiment/Simple Arm Experiments.xls'. File '/Users/dustyn/Dropbox/NYU-Poly/research/001 Robotic Metabolism/2 DOF Arm/experiment/Simple Arm Experiments.xls' not found.
Any thoughts? I'm on Mac OS X 10.7.5 and MATLAB R2012a

2 comentarios

If you try
exist('/Users/dustyn/Dropbox/NYU-Poly/research/001 Robotic Metabolism/2 DOF Arm/experiment/Simple Arm Experiments.xls')
then what does MATLAB say?
Also, if you
!ls '/Users/dustyn/Dropbox/NYU-Poly/research/001 Robotic Metabolism/2 DOF Arm/experiment/Simple Arm Experiments.xls'
Please check carefully that the case matches -- e.g., should the directory be Reseearch with a capital?
Theo Olsthoorn
Theo Olsthoorn el 11 de Oct. de 2013
Just save your excel file as excel 5.0/95 then it will work

Iniciar sesión para comentar.

Respuestas (2)

Theo Olsthoorn
Theo Olsthoorn el 11 de Nov. de 2014

1 voto

It starts being a shame on the Mathworks, even in version 2014 not being able to read modern xls files properly on OSX, because the ability to read xls files is such an important feature. I use it every day, but always have to revert to xls version 5.0/95, which is 20 years old !
Shashank Prasanna
Shashank Prasanna el 14 de En. de 2013

0 votos

XLSREAD is designed to read Excel files only on windows and will not work on Macs. By default XLSREAD will revert to CSVREAD on all Macs and on Windows systems that don't have Excel installed. This is because XLSREAD uses the ActiveX COM interface to communicate with Excel and this is windows specific. Please see the following link for more information:
The only work around currently is to make sure that the file in questions be saved as a CSV file if possible, this can be done through Excel via Save As.

8 comentarios

Walter Roberson
Walter Roberson el 14 de En. de 2013
Editada: Walter Roberson el 21 de En. de 2013
The information in that URL is correct for the release it mentions there, R2011A, but it is outdated. Dustyn is using R2012A, which supports more functionality even on OS-X.
If your system does not have Excel for Windows, xlsread operates in basic import mode, and reads only XLS or XLSX files.
The functionality was expanded even further in R2012B:
If your system does not have Excel for Windows, xlsread operates in basic import mode, and reads only XLS, XLSX, XLSM, XLTX, and XLTM files.
Ken Atwell
Ken Atwell el 18 de En. de 2013
Benji, you are mixing up XLS reading and writing. MATLAB has long had a capability to read older .XLS files, even on non-Windows platforms. The ability to read newer .XLSX files was new in 12a, as Walter detailed above. The limitation you describe (falling back to CSV) has to do with writing.
Back to the original question, I second Walter's suggest to carefully check the path -- MATLAB is having trouble finding the file, never mind importing it. If in doubt, navigate to that folder in MATLAB, and then open without need to get the path exactly right:
xlsread('Simple Arm Experiments.xls');
Shashank Prasanna
Shashank Prasanna el 21 de En. de 2013
Hi Ken and Walter, you are right, what I mentioned was not entirely right. With windows we can directly leverage everything the Excel.Application ACtiveX interface has to offer, which we is what MATLAB does long as it is windows and excel has been installed. Otherwise the formats specified by Walter from the doc are supported. Thanks for clarifying that in the forum.
Dustyn Roberts
Dustyn Roberts el 1 de Feb. de 2013
Editada: Walter Roberson el 2 de Feb. de 2013
Thanks for the help. Unfortunately it's still not working. I tried navigating directly to the folder, and making sure the matlab m file and xlsx file are in the same folder. Then when I run this code:
xlsread('Simple_Arm_Experiments_Summary.xlsx');
I get:
>> Simple Arm Experiments Summary
Undefined function 'Simple' for input arguments of type 'char'.
As you can see, I tried adding underscores in case space was an issue. Still no luck. Any thoughts?
You need to assign the output from xlsread()
Simple_Arm_Experiments_Summary = xlsread('Simple Arm Experiments Summary.xls');
Dustyn Roberts
Dustyn Roberts el 2 de Feb. de 2013
Editada: Walter Roberson el 2 de Feb. de 2013
tried that, same exact error. also tried specifying sheet and range i.e.:
data = xlsread('Simple_Arm_Experiments_Summary.xlsx', 'E.1', 'B2:C100');
still same error. why is matlab so behind on their documentation of this? argh
At the command line please try
which -all xlsread
I suspect you might have your own xlsread.m in the path.
Above you show,
>> Simple Arm Experiments Summary
How is that coming about? It has the appearance that you typed that in as a command, which does not make sense to me.
When you talk about "same error" are you referring to undefined function Simple, or are you referring to the original question with the unable to open file?

Iniciar sesión para comentar.

Productos

Etiquetas

Preguntada:

el 14 de En. de 2013

Respondida:

el 11 de Nov. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by