getvaropts - Get variable import options - MATLAB (original) (raw)
Get variable import options
Syntax
Description
[varOpts](#shared-varOpts) = getvaropts([opts](#bveto%5F7-1%5Fsep%5Fshared-opts),[selection](#shared-selection))
returns the variable import options for the variables specified inselection
.
Examples
Access the variable import options object that controls the importing of a variable using the getvaropts
function.
Create import options from a file. The options object is a collection of individual variable import options.
opts = detectImportOptions('patients.xls')
opts = SpreadsheetImportOptions with properties:
Sheet Properties: Sheet: ''
Replacement Properties: MissingRule: 'fill' ImportErrorRule: 'fill' MergedCellColumnRule: 'placeleft' MergedCellRowRule: 'placetop'
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: Show all 10 VariableOptions 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
Get the variable import options object for the specified variable.
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'
To modify the variable import options, see the setvaropts
and setvartype
function reference pages.
Input Arguments
File import options, specified as a SpreadsheetImportOptions
, DelimitedTextImportOptions
, or a FixedWidthImportOptions
object created by the detectImportOptions function. The opts
object contains properties that control the data import process, such as variable properties, data location properties, replacement rules, and others.
Data Types: char
| string
| cell
| uint64
Output Arguments
Version History
Introduced in R2016b