Next: , Previous: , Up: table   [Contents]


8.2.59.39 table.convertvars

Method: out = convertvars (obj, vars, dataType)

Convert variables to specified data type.

Converts the variables in obj specified by vars to the specified data type.

vars is a cellstr or numeric vector specifying which variables to convert.

dataType specifies the data type to convert those variables to. It is either a char holding the name of the data type, or a function handle which will perform the conversion. If it is the name of the data type, there must either be a one-arg constructor of that type which accepts the specified variables’ current types as input, or a conversion method of that name defined on the specified variables’ current type.

Returns a table with the same variable names as obj, but with converted types.