xlsread code works on windows but not on mac?
4 views (last 30 days)
Show older comments
Hi! I was sent a code to analyze some lab data and the code doesn't work in my computer. It gives me the following error:
Error using xlsread (line 260) Unable to read XLS file /Users/belmadelmar/Desktop/membrane data/BDS POPCBL-1.2 DataTable1.csv. File is not in recognized format.
I'm very confused because the code works perfectly in a Windows computer under the same conditions (using the same data files and everything. Is there something that I'm missing specifically for macs?
I'm using Matlab 2017b and MacOS High Sierra 10.13.3
Thank you in advance!
0 Comments
Answers (1)
Walter Roberson
on 9 Mar 2018
xlsread on MS Windows with Excel installed will use ActiveX to read .csv files.
xlsread on MS Windows without Excel installed, or on Mac or Linux, will use csvread(), which will use dlmread() which will use textscan(). csvread invoked through this sequence cannot skip text headers for rows or columns, supporting only pure numeric (including not supporting text time formats), and requires that each line has the same number of columns.
If you invoke csvread yourself, you can pass in the number of header lines and header columns to skip.
You should probably be considering switching to using readtable(), possibly using detectImportOptions to assist.
0 Comments
See Also
Categories
Find more on Use COM Objects in MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!