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
オブジェクトとして指定します。データから datastore オブジェクトを作成するには、関数 spreadsheetDatastore
または関数 datastore
を使用します。
データストア内のファイル。クエリするファイルの名前を含む文字ベクトルまたは string スカラーとして指定します。
filename
の値は、データストアの Files
プロパティに含まれるファイル名と完全に一致しなければなりません。ファイル名を完全に一致させるには、ssds.Files{N}
を使用して filename
を指定します。ここで N
は Files
プロパティ内のファイルのインデックスです。
例: names = sheetnames(ssds,ssds.Files{1})
は、データストア ssds
の Files
プロパティで指定された最初のファイルに含まれるシート名を返します。
データ型: char
| string
ファイル インデックス。正の整数として指定します。I
は ssds
内のファイル数を超えることはできません。
データ型: double
出力引数
シート名。指定されたファイル内のシート名を含む string 配列として返されます。
データ型: 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.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)