Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

How to import Excel file to MATLAB

Asked by Lokman Abdullah

Lokman Abdullah (view profile)

on 2 Feb 2011
Latest activity Commented on by Tina

Tina (view profile)

on 21 Apr 2015 at 17:42
         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.


Lokman Abdullah

Lokman Abdullah (view profile)


No products are associated with this question.

2 Answers

Answer by Martijn

Martijn (view profile)

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:


abdulkader helwan on 3 Nov 2013

i am trying this function but i get that error: XLSREAD unable to open file abd.xls. File C:\Users\Abdulkader\Documents\MATLAB\abd.xls not found. plz help

Image Analyst

Image Analyst (view profile)

on 3 Nov 2013

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


Tina (view profile)

on 21 Apr 2015 at 17:42

This was really helpful @Martijin!


Martijn (view profile)

Answer by Davide Ferraro

Davide Ferraro (view profile)

on 2 Feb 2011
Edited by John Kelly

John Kelly (view profile)

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:

1 Comment

Lokman Abdullah

Lokman Abdullah (view profile)

on 2 Feb 2011

thank you. really helpful

Davide Ferraro

Davide Ferraro (view profile)

Contact us