Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Help reading an Excel file with Matlab

  1. Dec 2, 2013 #1
    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.
     
  2. jcsd
  3. Dec 2, 2013 #2

    jedishrfu

    Staff: Mentor

    Last edited: Dec 2, 2013
  4. Dec 2, 2013 #3
    Oh, looks like I have the r2010b version. So I guess it only works in the latest version?
     
  5. Dec 2, 2013 #4

    jedishrfu

    Staff: Mentor

    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.
     
  6. Dec 2, 2013 #5

    Office_Shredder

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    If you have a text file csvread will work too.
     
  7. Dec 3, 2013 #6

    kreil

    User Avatar
    Gold Member

    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).
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Help reading an Excel file with Matlab
Loading...