'test.xls' is not in your current folder. Perhaps it's really called 'test.xlsx' or perhaps it's in a different folder. You can specify the folder it lives in and then use fullfile() to create the full file name.
folder = 'c:/whatever'
fullFileName = fullfile(folder, 'test.xls');
a = xlsread(fullFilename);
OR use the following to have the user manually locate it:
startingFolder = 'C:\Program Files\MATLAB';
if ~exist(startingFolder, 'dir')
startingFolder = pwd;
end
defaultFileName = fullfile(startingFolder, '*.xl*');
[baseFileName, folder] = uigetfile(defaultFileName, 'Select a file');
if baseFileName == 0
return;
end
fullFileName = fullfile(folder, baseFileName)
a = xlsread(fullFilename);
Best Answer