File Exchange

image thumbnail


version 1.7 (7.81 KB) by

GETXLS is a GUI that allows you to easily transfer data from an Excel file into Matlab's workspace.



View License

There are of course many ways to import data from an Excel file into Matlab. For instance, by clicking on an Excel file in the 'Current Folder' window within Matlab, one can select data and then push it into a variable in the base workspace. One can also use 'xlsread' to import data programmatically. Moreover, with the ExcelLink Toolbox, you can easily transfer data between Excel and Matlab in both direction, if you have this toolbox (which I don't). 'getxls' is just another possibility which, personally, I find often easier for quickly getting the data into Matlab. The GUI allows you to import eiher the raw data, just the numeric cells, only the dates cells, or only string cells. If you choose to import only date cells, then the GUI transforms the Excel date code to the corresponding Matlab date code.

The program can be instructive for other software developers as it has a few possibly unusual features. First of all, this GUI was created programmatically, without the help of GUIDE. This makes it, I think, somewhat more transparent. Secondly, and contrary to the code generated with GUIDE, it uses nested functions, which has the advantage that all variables that are defined in the main function are also in the scope of the nested functions. Thirdly, the program demonstrates how to use the Excel COM server. And finally, it demonstrates how to access Matlab's editor and create a new Matlab skript programmatically.

Acknowledgement: A small part of the program is heavily inspired by XLSREAD.

Please comment if you like it or if you find it useful.

Comments and Ratings (8)

Yvan Lengwiler

Yvan Lengwiler (view profile)

Hwang, thank you for the four stars you gave to my software. I am glad you like the program. It would be helpful for me if you could tell me what prevented you from giving it five stars. Do you have any suggestions for improvements?


Hwang (view profile)

Yvan Lengwiler

Yvan Lengwiler (view profile)

Dear Joseph. I'm sorry for your troubles. Also, I was traveling and could not answer earlier. I've checked the problem now. It is most likely due to a ~code, which is used in more recent versions of Matlab to indicate an output variable that is not used. Earlier versions do not understand this. I suggest that you make a global 'search and replace' in the code swapping '~' for 'temp'. I might do this in the next revision of the program to make it more friendly to older versions of Matlab. Hope this helps --- if not, let me know.


JOSEPH (view profile)

I downloaded this file on my laptop and when I run it matlab gives an error message says unexpected matlab operator in line 309 column 37. Not really good at matlab, please help


Shahab (view profile)


As a Mac user, some pre-download warning that this seems to be written for Windows would have been handy! But some of the other details are neat -- thanks :)

Moeti Ncube

Moeti Ncube (view profile)

Dude, u are the man!


Yuan (view profile)



'editorservices' is no longer supported by the latest version of ML. The new version of GETXLS adapts to this change.


Fixed bug that happened when only a single cell is selected. Moreover, showing Row/Col headings is now the default.


- If no range is selected, the whole worksheet is imported.
- 'Generate M-File' now reads the variablename and uses it for the generated script.


Fixed a minor bug that caused the variable to be pushed to the base workspace twice sometimes.


these updates:
 - added 'generate m-file' functionality
 - fixed bug when resizing window too small
 - fixed bug that manifested on empty worksheets


Added 'Dates' filter to extract only cells that have some date format.


Some improvements:
(1) callback to edVariable,
(2) toggle row/col headings and buttons for font size,
(3) use of 'genvarname' in case the user selects an invalid variable name,
(4) 'style' argument,
(5) tooltip texts to all objects in the GUI.

MATLAB Release
MATLAB 7.10 (R2010a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video