Help reading an Excel file with Matlab

Click For Summary

Discussion Overview

The discussion revolves around using MATLAB to read data from an Excel file, specifically focusing on the use of the readtable command and its compatibility with different versions of MATLAB. Participants are sharing their experiences and troubleshooting steps related to this issue.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant reports an error when using the readtable command, indicating a lack of compatibility with their version of MATLAB.
  • Another participant notes that the readtable function is available in MATLAB version r2013b and questions the version of the original poster's MATLAB.
  • The original poster confirms they are using version r2010b, suggesting that readtable may not be available in older versions.
  • One participant suggests using the xlsread function as an alternative, which is available in earlier releases of MATLAB.
  • Another participant mentions that csvread could also be used if the file is a text file.
  • A later reply points out that tables and categorical arrays were introduced in R2013b, and if the user has the Statistics Toolbox, they could use a dataset array as an alternative to tables.

Areas of Agreement / Disagreement

Participants generally agree that the readtable function is not available in older versions of MATLAB, but there are multiple competing views regarding alternative methods to read data from Excel files.

Contextual Notes

The discussion highlights limitations related to version compatibility and the availability of specific functions in different MATLAB releases. There is also a mention of the Statistics Toolbox, which may influence the options available to users.

Who May Find This Useful

This discussion may be useful for MATLAB users, particularly those working with older versions of the software or those seeking alternatives for reading data from Excel files.

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.
 
If you have a text file csvread will work too.
 
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).
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 18 ·
Replies
18
Views
6K
Replies
2
Views
3K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 2 ·
Replies
2
Views
2K