setvartype
Set variable data types for selected variables.
📝Syntax
opts = setvartype(opts, selection, types)
📥Input Arguments
Parameter Description
opts an import options object (delimited text or spreadsheet).
selection variable names (character vector, string array or cell of character vectors) or numeric indices.
types a single type applied to all selected variables, or one type per selected variable.
📤Output Arguments
Parameter Description
opts the updated import options object.
📄Description

setvartype sets the data types of the selected variables of an import options object, updating both VariableTypes and the per-variable options.

💡Examples
opts = delimitedTextImportOptions('NumVariables', 2);
opts.VariableNames = ["id", "value"];
opts = setvartype(opts, ["id", "value"], 'double')
🔗See Also
setvaroptsgetvaroptsdelimitedTextImportOptions
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub