I'm trying to read some data stored in a .xlsx file into MATLAB. However, using xlsread returns an empty data set.
data = xlsread('myFile.xlsx');
The sheet name is the standard 'Sheet1', so I know it's not looking for the wrong sheet.
I even checked to make sure the file exists, and went as far as to use uigetfile to ensure the path and string names are correct:
[fileName,dirName]=uigetfile('.xlsx');
data = xlsread(fullfile(dirName,fileName));
What am I doing wrong?
xlsread
only returns numeric data when only one output is specified. If the .xlsx file contains only text data, it will return empty. To remedy this, specify the outputs:
[fileName,dirName]=uigetfile('.xlsx');
[~,~,rawData] = xlsread(fullfile(dirName,fileName));
will return the entire contents of the sheet without MATLAB parsing the results and deciding what's text and what's numeric data.