Help reading an Excel file with Matlab

  • #1

Main Question or Discussion Point

Hi everyone, this is my first post on the physics forums. I am trying to use the readtable command in Matlab to make a table from an Excel file. Matlab is still new to me so I'm running into problems a lot. When I input T = readtable('myfile.txt'), I get an error that says "??? Undefined function or method 'readtable' for input arguments of type 'char'." Can anybody tell me what to do differently? I followed the Matlab instructions to the tee.
 

Answers and Replies

  • #2
11,334
4,806
Last edited:
  • #3
Oh, looks like I have the r2010b version. So I guess it only works in the latest version?
 
  • #4
11,334
4,806
Oh, looks like I have the r2010b version. So I guess it only works in the latest version?
if you poke around google there may be some user code to do it.

Did you try the xlsread function? it appears to be in earlier releases. Just change the name from readtable to xlsread.
 
  • #5
Office_Shredder
Staff Emeritus
Science Advisor
Gold Member
3,750
99
If you have a text file csvread will work too.
 
  • #6
kreil
Insights Author
Gold Member
668
67
Tables and categorical arrays are new for R2013b, so you won't be able to use them in older versions even if you use a legacy import function.

There is a catch though, if you have Statistics Toolbox. If so, you can use a dataset array from the toolbox (very similar to a table).
 

Related Threads for: Help reading an Excel file with Matlab

Replies
3
Views
2K
Replies
4
Views
6K
  • Last Post
Replies
2
Views
6K
  • Last Post
Replies
6
Views
2K
Replies
1
Views
799
  • Last Post
Replies
18
Views
3K
Top