Basic MATLAB questi...
 

  You don't need to be an 'investor' to invest in Singletrack: 6 days left: 95% of target - Find out more

[Closed] Basic MATLAB question - xlsread

3 Posts
2 Users
0 Reactions
116 Views
Posts: 2418
Free Member
Topic starter
 

Hi all,

Really stupid question. Trying to import data from a spreadsheet into MATLAB (2013a) using xlsread.

How do I tell MATLAB where the file is located? If I put in;

num = xlsread ('MATLABtest.xlsx')

It says

XLSREAD unable to open file 'MATLABtest.xlsx'.
File 'C:\Users\Duane\MATLABtest.xlsx' not found.

As that is not where the file is. If I move the file to C:\Users\Duane, it imports fine, but obviously I don't want all my files there.

Ta,
Duane.


 
Posted : 10/02/2014 1:00 pm
Posts: 23277
Free Member
 

as default it'll look in the folder you are currently working in, which I assume is C:\Users\Duane.

If you want to look elsewhere then use:

num = xlsread('C:\Blah\blah\blah\filename.xls')


 
Posted : 10/02/2014 1:05 pm
Posts: 23277
Free Member
 

or use this:

[Filename, Pathname] = uigetfile('C:\*.xls');
num = xlsread([Pathname '\' Filename]);


 
Posted : 10/02/2014 1:09 pm
Posts: 2418
Free Member
Topic starter
 

Cheers bud!


 
Posted : 10/02/2014 1:48 pm

6 DAYS LEFT
We are currently at 95% of our target!