Help reading an Excel file with Matlab

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
5 replies · 9K views
quantumspark
Messages
2
Reaction score
0
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.
 
Physics news on Phys.org
Oh, looks like I have the r2010b version. So I guess it only works in the latest version?
 
quantumspark said:
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.
 
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).