sheetnames
从数据存储中查询工作表名称
说明
示例
创建包含文件 airlinesmall_subset.xlsx 的数据存储。
ssds = spreadsheetDatastore('airlinesmall_subset.xlsx')
ssds =
SpreadsheetDatastore with properties:
Files: {
' ...\matlab\toolbox\matlab\demos\airlinesmall_subset.xlsx'
}
AlternateFileSystemRoots: {}
Sheets: ''
Range: ''
ReadFailureRule: 'error'
MaxFailures: Inf
Sheet Format Properties:
NumHeaderLines: 0
ReadVariableNames: true
VariableNames: {'Year', 'Month', 'DayofMonth' ... and 26 more}
VariableTypes: {'double', 'double', 'double' ... and 26 more}
Properties that control the table returned by preview, read, readall:
SelectedVariableNames: {'Year', 'Month', 'DayofMonth' ... and 26 more}
SelectedVariableTypes: {'double', 'double', 'double' ... and 26 more}
ReadSize: 'file'
查询数据存储中第一个(且仅此一个)文件的工作表名称。
sheetnames(ssds,1)
ans =
13×1 string array
"1996"
"1997"
"1998"
"1999"
"2000"
"2001"
"2002"
"2003"
"2004"
"2005"
"2006"
"2007"
"2008"
输入参数
输入数据存储,指定为 SpreadsheetDatastore 对象。使用 spreadsheetDatastore 函数或 datastore 函数根据您的数据创建数据存储对象。
数据存储中的文件,指定为字符向量或字符串标量,其中包含要查询的文件的名称。
filename 的值必须与数据存储的 Files 属性包含的文件名完全匹配。要确保文件名完全匹配,请使用 ssds.Files{N} 指定 filename,其中 N 是 Files 属性中的文件的索引。
示例: names = sheetnames(ssds,ssds.Files{1}) 返回数据存储 ssds 的 Files 属性指定的第一个文件中包含的工作表名称。
数据类型: char | string
文件索引,指定为正整数。I 不能超出 ssds 中的文件数。
数据类型: double
输出参量
工作表名称,以字符串数组形式返回,其中包含指定文件中的工作表名称。
数据类型: string
版本历史记录
在 R2016a 中推出
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)