opts = setvaropts(opts, selection, Name, Value)
opts = setvaropts(opts, selection, Name1, Value1, Name2, Value2, ...)
| 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. |
| Name, Value | per-variable options such as 'Type', 'InputFormat', 'WhitespaceRule', 'EmptyFieldRule' or 'FillValue'. |
| Parameter | Description |
|---|---|
| opts | the updated import options object. |
setvaropts sets per-variable import options for the selected variables of an import options object and returns the updated object.
The selection is validated against the declared variable names. Setting the 'Type' option also updates the corresponding entry of VariableTypes.
opts = delimitedTextImportOptions('NumVariables', 2);
opts.VariableNames = ["date", "value"];
opts.VariableTypes = ["datetime", "double"];
opts = setvaropts(opts, "date", 'InputFormat', 'MM/dd/yy')
| Version | Description |
|---|---|
| 2.0.0 | initial version |