writeexcel

版本 1.0.0.0 (4.9 KB) 作者: Peder Axensten
Writes data to an Excel xml file on any system (NO Excel or ActiveX required!).
3.4K 次下载
更新时间 2007/10/8

查看许可证

Usage: writeexcel(file, varlist)

Writes data to an Excel xml file on any system (NO Excel or ActiveX required!).

Scalars will end up on a sheet called "Scalars" as name (in the first column) and value (in the second column) pairs. Arrays and cell arrays are saved on individual sheets, named by the variable name.

If you find any errors, please let me know at peder at axensten dot se. This is still pretty much work in progress, see 'to do', below.

ARGUMENTS:
file File name path. If prefixed with a '>' (see example, below), the data will be added to an existing file (that was generated by this macro!).
varlist List of variables, expressions, and/or strings. Variables and expressions will be written to the file, expressions must be preceded by a '\name', below. A special case is if a variable of type structure is called DocumentProperties, its field names and values will set the document properties (see the example). Strings can be of the following: - '\name' sets the name of the next variable or expression, names must be unique.

EXAMPLE:
DocumentProperties= struct('Title','My Title','Author','Me','Subject','very interesting');
astring= 'Hi ya!';
ascalar= pi;
anarray= [1 2 3; 4 5 6];
acellarr= {'abc', 'def'; pi, NaN; -Inf Inf};
writeexcel('Workbook.xml', anarray, ascalar, astring, acellarr, DocumentProperties);
writeexcel('>Workbook.xml', '\another scalar', 2*pi/5);

HISTORY:
Version 1.0, first working version, 2007-09-04.
Version 1.1, released 2007-09-06:
- Fixed a bug when saving vectors.
- Fixed a bug when adding scalars when there previously were none.
- Now UTF-8 works.
- Added check for possible fopen problems.
- Added better input argument check.
- Can now add document metadata through structure named DocumentProperties.
- Writing structures too, columns named by fieldnames (the struct class).
- Writing symbolic expressions too (the sym class).
Version 1.2, released 2007-09-18:
- Fixed mlint warnings.
- Fixed problem with certain characters in meta data.
- Removed all regexprep calls for better compatibility.
- Removed automatic .xls suffix.

TO DO:
- '%format' or {'%form1', '%form2', etc.} to control how columns will be shown (numbers will be stored with 'all' decimals, but the column formats will be set)

COPYRIGHT: (c) 2007 Peder Axensten. Use at own risk.

KEYWORDS: save, export, write, Microsoft, Excel, xml

REQS: Does NOT require Excel, Active X, or a Windows system!

REFERENCE: http://msdn2.microsoft.com/en-us/library/aa140066(office.10).aspx

引用格式

Peder Axensten (2024). writeexcel (https://www.mathworks.com/matlabcentral/fileexchange/16229-writeexcel), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2007a
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0

- Fixed mlint warnings.
- Fixed problem with certain characters in meta data.
- Removed all regexprep calls for better compatibility.
- Removed automatic .xls suffix.