FUNCTION REFERENCE
setvaropts
Set options of variables in import options.
Set options of variables in import options.
Syntax
opts = setvaropts(opts, Name, Value, ...)Syntax
opts = setvaropts(opts, selection, Name, Value, ...)Returns a copy of opts with the named variable options set for the selected variables (all without a selection): 'FillValue' (a value of the variable's type), 'TreatAsMissing' (texts read as missing), 'DecimalSeparator', 'ThousandsSeparator', 'TrimNonNumeric', 'ExponentCharacter', 'InputFormat' and 'DatetimeFormat' (datetime), 'DurationFormat', 'WhitespaceRule' ('trim', 'trimleading', 'trimtrailing', 'preserve'), 'EmptyFieldRule' ('missing', 'error', 'auto'), 'QuoteRule', 'Prefixes', 'Suffixes', 'Categories', 'Protected', 'Ordinal', 'TrueSymbols', 'FalseSymbols', 'CaseSensitive' and 'Name'. An option that does not apply to a selected variable's type is an error; use setvartype to change types.
Example
writecell({'a', 'b'; 1, 2; 3, ''}, 'ab.csv'); opts = setvaropts(detectImportOptions('ab.csv'), 'b', 'FillValue', 0); T = readtable('ab.csv', opts); T.b' % [2 0]Differences from MATLAB: DatetimeLocale accepts English locales only; TimeZone '' or 'UTC'; NumberSystem 'decimal' only.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.