Main Content

getvaropts

변수에 대한 가져오기 옵션 가져오기

설명

예제

varOpts = getvaropts(opts,selection)selection에 지정된 변수에 대한 변수 가져오기 옵션을 반환합니다.

예제

모두 축소

getvaropts 함수를 사용하여 변수 가져오기를 제어하는 variable import options 객체에 액세스합니다.

파일에서 가져오기 옵션을 생성합니다. options 객체는 개별 변수 가져오기 옵션의 모음입니다.

opts = detectImportOptions('patients.xls')
opts = 
  SpreadsheetImportOptions with properties:

   Sheet Properties:
                        Sheet: ''

   Replacement Properties:
                  MissingRule: 'fill'
              ImportErrorRule: 'fill'

   Variable Import Properties: Set types by name using setvartype
                VariableNames: {'LastName', 'Gender', 'Age' ... and 7 more}
                VariableTypes: {'char', 'char', 'double' ... and 7 more}
        SelectedVariableNames: {'LastName', 'Gender', 'Age' ... and 7 more}
              VariableOptions: [1-by-10 matlab.io.VariableImportOptions] 
	Access VariableOptions sub-properties using setvaropts/getvaropts
           VariableNamingRule: 'modify'

   Range Properties:
                    DataRange: 'A2' (Start Cell)
           VariableNamesRange: 'A1'
                RowNamesRange: ''
           VariableUnitsRange: ''
    VariableDescriptionsRange: '' 
	To display a preview of the table, use preview

지정된 변수에 대한 variable import options 객체를 가져옵니다.

varOpts = getvaropts(opts, 'Systolic')
varOpts = 
  NumericVariableImportOptions with properties:

   Variable Properties:
                  Name: 'Systolic'
                  Type: 'double'
             FillValue: NaN
        TreatAsMissing: {}
             QuoteRule: 'remove'
              Prefixes: {}
              Suffixes: {}
        EmptyFieldRule: 'missing'

   Numeric Options:
     ExponentCharacter: 'eEdD'
      DecimalSeparator: '.'
    ThousandsSeparator: ''
        TrimNonNumeric: 0
          NumberSystem: 'decimal'

변수 가져오기 옵션을 수정하려면 setvaroptssetvartype 함수 도움말 페이지를 참조하십시오.

입력 인수

모두 축소

파일 가져오기 옵션으로, detectImportOptions 함수에 의해 생성된 SpreadsheetImportOptions, DelimitedTextImportOptions 또는 FixedWidthImportOptions 객체로 지정됩니다. opts 객체는 변수 속성, 데이터 위치 속성, 대체 규칙 같은 데이터 가져오기 프로세스를 제어하는 속성을 포함합니다.

선택한 변수로, 문자형 벡터, string형 스칼라, 문자형 벡터로 구성된 셀형 배열, string형 배열, 숫자형 인덱스로 구성된 배열 또는 논리형 배열로 지정됩니다.

변수 이름(또는 인덱스)은 opts 객체의 VariableNames 속성에 포함된 이름의 서브셋이어야 합니다.

예: 'Height'

예: {'Height','LastName'}

예: [5 9]

데이터형: char | string | cell | uint64

출력 인수

모두 축소

선택한 변수에 대한 유형 종속 옵션으로, variable import options 객체로 구성된 배열로 반환됩니다. 이 배열은 selection 인수에 지정된 각 변수에 대응되는 객체를 포함합니다. 변수의 데이터형에 따라, 배열에 포함되는 각 객체는 숫자, 텍스트, logical, datetime 또는 categorical 데이터형일 수 있습니다.

개별 객체의 속성은 수정할 수 있습니다.

  • Type 속성을 수정하려면 setvartype 함수를 사용하십시오.

  • 기타 속성을 수정하려면 setvaropts 함수를 사용하십시오.

버전 내역

R2016b에 개발됨