File Exchange

image thumbnail


version (38.5 KB) by Gordon Ray
MATLAB MEX function to create an Excel spreadsheet.

1 Download

Updated 24 Mar 2004

View License

Functionally the same xlswrite.m (by Scott Hirsch), the only difference is in the implementation.

XLSWriteMex is implemented in C++ and compiled into a MATLAB MEX dll. I did this because 'xlswrite.m' does not compile using the MATLAB compiler, so any MATLAB program using 'xlswrite.m' cannot be compiled into a stand-alone app.

Using XLSWriteMex instead of xlswrite will solve this problem.

Example using XLSWriteMex:
m = rand(100,4);
header = 'This is some introductory information at the top of my spreadsheet.';
colnames = {'Ch1','Ch2','Ch3','Ch4'};
filename = 'myfile.xls';

Will create a spreadsheet named myfile.xls

Cite As

Gordon Ray (2021). XLSWriteMex (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (10)


It's not clear how the DLL should be loaded. Where does the file/folder need to be placed? Does it need to be loaded with 'loadlibrary'? Please include a readme file with instructions. Thanks

Where to paste this file??
i have an error undefined function or command


Is there a way to use the functionality of the built in xlswrite function with this file?
Instead of "XLSWriteMex(m,header,colnames,filename)"
is there a way to use "xlswrite(File,data,sheet,location)" in a compiled version?

Liaquat Iqbal

Wan an Cui

Very good! If the author can add path to the created file,it will be more excellent.
For example, I hope the created file in "D:\mywork\Matlab",but I do not know how to realize it. Thanks the author.

Wan an Cui

Wan an Cui

very good!

Garner Zuir

Interesting and useful

Jean Ghanem

Very nice

martyn dorey


MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!