萍聚社区-德国热线-德国实用信息网

 找回密码
 注册

微信登录

微信扫一扫,快速登录

萍聚头条

查看: 2324|回复: 4

[工程类] Ausgangsgrösse in Excel-datei?

[复制链接]
发表于 2007-8-27 21:34 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册 微信登录

x
我在做Projekt时遇到一个棘手的问题,想请教一下各位.

不知道MATLAB的数据能不能以Excel的表格形式输出,还望各位高手指点一二。

急切等待中。。。。谢谢!
Die von den Nutzern eingestellten Information und Meinungen sind nicht eigene Informationen und Meinungen der DOLC GmbH.
发表于 2007-8-27 23:02 | 显示全部楼层
Die von den Nutzern eingestellten Information und Meinungen sind nicht eigene Informationen und Meinungen der DOLC GmbH.
发表于 2007-8-27 23:07 | 显示全部楼层
xlswrite

Write Microsoft Excel spreadsheet file (.xls)
Syntax

xlswrite(filename, M)
xlswrite(filename, M, sheet)
xlswrite(filename, M, 'range')
xlswrite(filename, M, sheet, 'range')
status = xlswrite(filename, ...)
[status, message] = xlswrite(filename, ...)
xlswrite filename M sheet range
Description

xlswrite(filename, M) writes matrix M to the Excel file filename. The filename input is a string enclosed in single quotes. The input matrix M is an m-by-n numeric, character, or cell array, where m < 65536 and n < 256. The matrix data is written to the first worksheet in the file, starting at cell A1.

xlswrite(filename, M, sheet) writes matrix M to the specified worksheet sheet in the file filename. The sheet argument can be either a positive, double scalar value representing the worksheet index, or a quoted string containing the sheet name.

If sheet does not exist, a new sheet is added at the end of the worksheet collection. If sheet is an index larger than the number of worksheets, empty sheets are appended until the number of worksheets in the workbook equals sheet. In either case, MATLAB generates a warning indicating that it has added a new worksheet.

xlswrite(filename, M, 'range') writes matrix M to a rectangular region specified by range in the first worksheet of the file filename. Specify range using one of the following quoted string formats:

    *

      A cell designation, such as 'D2', to indicate the upper left corner of the region to receive the matrix data.
    *

      Two cell designations separated by a colon, such as 'D2:H4', to indicate two opposing corners of the region to receive the matrix data. The range 'D2:H4' represents the 3-by-5 rectangular region between the two corners D2 and H4 on the worksheet.

The range input is not case sensitive and uses Excel A1 notation. (See help in Excel for more information on this notation.)

The size defined by range should fit the size of M or contain only the first cell, (e.g., 'A2'). If range is larger than the size of M, Excel fills the remainder of the region with #N/A. If range is smaller than the size of M, only the submatrix that fits into range is written to the file specified by filename.

xlswrite(filename, M, sheet, 'range') writes matrix M to a rectangular region specified by range in worksheet sheet of the file filename. See the previous two syntax formats for further explanation of the sheet and range inputs.

status = xlswrite(filename, ...) returns the completion status of the write operation in status. If the write completed successfully, status is equal to logical 1 (true). Otherwise, status is logical 0 (false). Unless you specify an output for xlswrite, no status is displayed in the Command Window.

[status, message] = xlswrite(filename, ...) returns any warning or error message generated by the write operation in the MATLAB structure message. The message structure has two fields:

    *

      message — String containing the text of the warning or error message
    *

      identifier — String containing the message identifier for the warning or error

xlswrite filename M sheet range is the command format for xlswrite, showing its usage with all input arguments specified. When using this format, you must specify sheet as a string (for example, Income or Sheet4). If the sheet name contains space characters, then quotation marks are required around the string (for example, 'Income 2002').

      Note   The above functionality depends upon having Microsoft Excel as a COM server. In absence of Excel, matrix M is written as a text file in Comma-Separated Value (CSV) format. In this mode, the sheet and range arguments are ignored.

Examples
Example 1 — Writing Numeric Data to the Default Worksheet

Write a 7-element vector to Microsoft Excel file testdata.xls. By default, the data is written to cells A1 through G1 in the first worksheet in the file:

xlswrite('testdata', [12.7 5.02 -98 63.9 0 -.2 56])

Example 2 — Writing Mixed Data to a Specific Worksheet

This example writes the following mixed text and numeric data to the file tempdata.xls:

d = {'Time', 'Temp'; 12 98; 13 99; 14 97};

Call xlswrite, specifying the worksheet labeled Temperatures, and the region within the worksheet to write the data to. The 4-by-2 matrix will be written to the rectangular region that starts at cell E1 in its upper left corner:

s = xlswrite('tempdata.xls', d, 'Temperatures', 'E1')
s =
    1

The output status s shows that the write operation succeeded. The data appears as shown here in the output file:

Time   Temp
  12     98
  13     99
  14     97

Example 3 — Appending a New Worksheet to the File

Now write the same data to a worksheet that doesn't yet exist in tempdata.xls. In this case, MATLAB appends a new sheet to the workbook, calling it by the name you supplied in the sheets input argument, 'NewTemp'. MATLAB displays a warning indicating that it has added a new worksheet to the file:

xlswrite('tempdata.xls', d, 'NewTemp', 'E1')
Warning: Added specified worksheet.

If you don't want to see these warnings, you can turn them off using the command indicated in the message above:

warning off MATLAB:xlswrite:AddSheet

Now try the command again, this time creating another new worksheet, NewTemp2. Although the message is not displayed this time, you can still retrieve it and its identifier from the second output argument, m:

[stat msg] = xlswrite('tempdata.xls', d, 'NewTemp2', 'E1');

msg
msg =
       message: 'Added specified worksheet.'
    identifier: 'MATLAB:xlswrite:AddSheet'

See Also
Die von den Nutzern eingestellten Information und Meinungen sind nicht eigene Informationen und Meinungen der DOLC GmbH.
 楼主| 发表于 2007-8-27 23:25 | 显示全部楼层
知道有xlswrite这个funktion就安心了,我仔细研究下,谢谢!
Die von den Nutzern eingestellten Information und Meinungen sind nicht eigene Informationen und Meinungen der DOLC GmbH.
发表于 2007-8-28 11:07 | 显示全部楼层
Die von den Nutzern eingestellten Information und Meinungen sind nicht eigene Informationen und Meinungen der DOLC GmbH.
您需要登录后才可以回帖 登录 | 注册 微信登录

本版积分规则

手机版|Archiver|AGB|Impressum|Datenschutzerklärung|萍聚社区-德国热线-德国实用信息网 |网站地图

GMT+2, 2024-4-29 13:55 , Processed in 0.062032 second(s), 20 queries , MemCached On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表