MATLAB Answers


Converting a .mat file to .xls

Asked by John
on 24 Feb 2012

Hi there,

Is there anyway to convert a .mat file to an excel file in matlab?

Thank you




No products are associated with this question.

2 Answers

Answer by Kaustubha Govind
on 24 Feb 2012

You need to write MATLAB code to do this. First load the contents of the MAT-file into the workspace using the load command. You can then get the names of the variables in the workspace by using something like:

   varNames = who;

Be careful to not get variables that you may have created before the MAT-file was loaded.

You can then loop through the cell-array and write each variable to an Excel file using xlswrite.


Answer by Sean de Wolski
on 24 Feb 2012
doc importdata
doc xlswrite

Some friends for your journey...


Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!