Interfacing MATLAB and EXCEL

January 25, 2010 by Admin 
Filed under: Tutorials, Utility 
1 Comment
VN:F [1.8.8_1072]
Rating: +1 (from 1 vote)
VN:F [1.8.8_1072]
Rating: 10.0/10 (1 vote cast)

Matlab vs Excel

The first very basic things you may want to know are how to write and read from an .xls file.

  • xlswrite: xlswrite(filename, M) writes matrix M to the Excel file filename. The filename input is a string enclosed in single quotation marks, and should include the file extension. The matrix M is an m-by-n numeric or character array. xlswrite writes the matrix data to the first worksheet in the file, starting at cell A1. For more click here.
  • xlsread: num = xlsread(filename) returns numeric data in double array num from the first sheet in the Microsoft Excel spreadsheet file named filename. The filename argument is a string enclosed in single quotation marks. For more click here.
  • Sometimes may also be useful the xlsfinfo to determine whether file contains a Microsoft Excel spreadsheet

And if you want to build an external application like a MATLAB made excel add-in you may want to give a look at:

  • MATLAB Builder EX 1.2.13 : Deploy MATLAB code as Microsoft Excel add-ins.MATLAB® Builder™ EX lets you integrate MATLAB® applications into your organization’s Excel® workbooks as macro functions or add-ins that can be deployed royalty free. The MATLAB Builder EX product creates the add-ins by encrypting your MATLAB functions, packaging the functions as a DLL that is accessible from Excel, and generating a Microsoft® Visual Basic® for Applications (VBA) wrapper around them.

To edit properties of an xls file:

To Add a figure into an excel spreadsheet:

  • xlswritefig: XLSWRITEFIG allows you to programmatically place a MATLAB figure inside of an Excel spreadsheet. This can be a useful supplement to XLSWRITE.

You may also want a speed up:

If you are working with temporal data:

  • xlsdate.m: converts a MS Excel date to year, month and day

And if you have 3D arrays:

  • xlswrite 3D: xlswrite is limited to writing 2D arrays to Excel. This is a simple function that allows you to write 3D arrays to Excel

Ok something is not clear, but don’t worry, here is some tutorial:

VN:F [1.8.8_1072]
Rating: 10.0/10 (1 vote cast)
VN:F [1.8.8_1072]
Rating: +1 (from 1 vote)
Interfacing MATLAB and EXCEL10.0101

Popularity: 1% [?]

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • Live
  • PDF
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Add to favorites
  • email
  • MySpace
  • RSS

Related Posts

Comments

One Comment on Interfacing MATLAB and EXCEL

  1. Chris R on Thu, 12th Aug 2010 17:54
  2. This GUI is very versatile and will import excel data and create different types of 3D maps.

    http://www.mathworks.com/matlabcentral/fileexchange/28177-3d-performance-map-gui

    Hope this helps,
    Chris

    [Reply]

    UN:F [1.8.8_1072]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.8_1072]
    Rating: 0 (from 0 votes)

Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!


Include MATLAB code in your comment by doing the following:

<pre lang="MATLAB">

%insert code here

</pre>