Asked by Lokman Abdullah
on 2 Feb 2011

0 2.49939 2.00E-04 -1.28174 4.00E-04 3.05481 6.00E-04 0.790405 8.00E-04 -0.448608 1.00E-03 2.28577 1.20E-03 1.11084 1.40E-03 8.54E-02 1.60E-03 2.30713 1.80E-03 1.77307 2.00E-03 -0.83313 2.20E-03 3.22571 2.40E-03 1.34583 2.60E-03 0.27771 2.80E-03 1.19629 3.00E-03 0.341797 3.20E-03 1.36719 3.40E-03 1.96533 3.60E-03 0.448608 3.80E-03 3.26843 4.00E-03 0.683594 4.20E-03 -1.83716 4.40E-03 4.14429

For example, I have this kind of numerical data with 2 column and 10 rows in my excel file. How to import the Excel file to MATLAB? I need the data to plot the graph.

*No products are associated with this question.*

Answer by Martijn
on 2 Feb 2011

Accepted answer

Importing data from Excel can be done using the XLSREAD function, for example to read all data from myfile.xls:

A = xlsread('myfile.xls')

Or to only read a specific range from a specific sheet:

B = xlsread('myfile.xls','Sheet 1','B10:F28')

More information can be found in the documentation:

http://www.mathworks.com/help/releases/R2010b/techdoc/ref/xlsread.html

abdulkader helwan
on 3 Nov 2013

Image Analyst
on 3 Nov 2013

The file is not there. Correct the filename, or else find the file and put it in that folder.

Answer by Davide Ferraro
on 2 Feb 2011

Edited by John Kelly
on 26 Feb 2015

If you prefer to use an **interactive** approach you can double click on the Excel file from the Current Folder browser and interactively import the data. As soon as the data is in your workspace you can use PlotTools to quickly create and customize your plot.

The Import Wizard GUI is presented on page:

http://www.mathworks.com/help/matlab/low-level-file-i-o.html#f10-61402

Answer by Chetan Rawal
on 10 Sep 2015

There are newer ways to do this using Tables. See this link for all options of using MATLAB with Excel:

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply Today
## 0 Comments