xlswrite
(Not recommended) Write spreadsheet file
xlswrite is not recommended. Use writetable, writematrix, or writecell
instead. For more information, see Compatibility
Considerations.
Syntax
Description
returns the status of the write operation, using any of the input arguments in
previous syntaxes. When the operation is successful, status is
status = xlswrite(___)1. Otherwise, status is 0.
Examples
Input Arguments
Output Arguments
Limitations
The
xlswritefunction does not support writing cell arrays that contain different data types when attempting to write CSV files.If your computer does not have Excel for Windows® or you are using MATLAB® Online™, then the
xlswritefunction:Writes array
Ato a text file in comma-separated value (CSV) format.Amust be a numeric matrix.Ignores the
sheetandxlRangearguments.
This limitation also applies when the COM server (part of the typical installation of Excel) is not available.
Tips
If your computer has Microsoft Office 2003 software, but you want to create a file in an Excel 2007 format, install the Office 2007 Compatibility Pack.
Excel and MATLAB can store dates as text that represents those dates (such as
'10/31/96') or serial date numbers (such as729329). If your array includes serial date numbers, convert these dates to their text representation usingdatestrbefore callingxlswrite.To write data to Excel files with custom formats (such as fonts or colors), access the Windows COM server directly using
actxserverrather thanxlswrite. For example, this MathWorks Support Answer usesactxserverto establish a connection between MATLAB and Excel, writes data to a worksheet, and specifies the colors of the cells.
Algorithms
Excel converts Inf values to 65535.
MATLAB converts NaN values to empty cells.
Version History
Introduced before R2006aSee Also
writematrix | writecell | xlsread | xlsfinfo | writetable | dlmwrite