Main Content

sheetnames

데이터저장소에서 시트 이름 쿼리

설명

names = sheetnames(ssds,filename)은 데이터저장소 ssds의 지정된 파일에서 시트 이름을 반환합니다.

예제

names = sheetnames(ssds,I)는 지정된 파일 인덱스에서 시트 이름을 반환합니다.

예제

모두 축소

파일 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'

데이터저장소에 포함된 첫 번째 파일(단 1개)의 시트 이름을 쿼리합니다.

sheetnames(ssds,1)
ans = 

  13×1 string array

    "1996"
    "1997"
    "1998"
    "1999"
    "2000"
    "2001"
    "2002"
    "2003"
    "2004"
    "2005"
    "2006"
    "2007"
    "2008"

입력 인수

모두 축소

입력 데이터저장소로, SpreadsheetDatastore 객체로 지정됩니다. spreadsheetDatastore 함수나 datastore 함수를 사용하여 데이터에서 datastore 객체를 생성할 수 있습니다.

데이터저장소에 포함된 파일로, 쿼리할 파일의 이름을 포함하는 문자형 벡터 또는 string형 스칼라로 지정됩니다.

filename의 값은 데이터저장소의 Files 속성에 포함된 파일 이름과 정확하게 일치해야 합니다. 파일 이름이 정확하게 일치하는지 확인하려면 ssds.Files{N}을 사용하여 filename을 지정하십시오. 여기서 NFiles 속성에 있는 파일의 인덱스입니다.

예: names = sheetnames(ssds,ssds.Files{1})은 데이터저장소 ssdsFiles 속성에 지정된 첫 번째 파일에 포함된 시트 이름을 반환합니다.

데이터형: char | string

파일 인덱스로, 양의 정수로 지정됩니다. Issds에 포함된 파일 개수를 초과할 수 없습니다.

데이터형: double

출력 인수

모두 축소

시트 이름으로, 지정된 파일에 있는 시트 이름이 포함된 string형 배열로 반환됩니다.

데이터형: string

버전 내역

R2016a에 개발됨