MATLAB 帮助中心
本页翻译不是最新的。点击此处可查看最新英文版本。
从数据存储中查询工作表名称
names = sheetnames(ssds,filename)
names = sheetnames(ssds,I)
names = sheetnames(ssds,filename) 从数据存储 ssds 中的指定文件返回工作表名称。
names
ssds
filename
names = sheetnames(ssds,I) 从指定的文件索引返回工作表名称。
I
示例
全部折叠
创建包含文件 airlinesmall_subset.xlsx 的数据存储。
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 对象。使用 spreadsheetDatastore 函数或 datastore 函数根据您的数据创建数据存储对象。
spreadsheetDatastore
datastore
数据存储中的文件,指定为字符向量或字符串标量,其中包含要查询的文件的名称。
filename 的值必须与数据存储的 Files 属性包含的文件名完全匹配。要确保文件名完全匹配,请使用 ssds.Files{N} 指定 filename,其中 N 是 Files 属性中的文件的索引。
Files
ssds.Files{N}
N
示例: names = sheetnames(ssds,ssds.Files{1}) 返回数据存储 ssds 的 Files 属性指定的第一个文件中包含的工作表名称。
names = sheetnames(ssds,ssds.Files{1})
数据类型: char | string
char
string
文件索引,指定为正整数。I 不能超出 ssds 中的文件数。
数据类型: double
double
工作表名称,以字符串数组形式返回,其中包含指定文件中的工作表名称。
数据类型: string
在 R2016a 中推出
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 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处