Tcast object
Introduction
The TCAST object is available with Solo_Predictor and Solo applications as a data type management object. It allows for conversion between various data types. The object is most often used with instrument or database import objects which may return results in a numerical format other than the PLS_Toolbox standard of double precision. But it can also be useful when the format of the output value needs to be a specific string format.
Invocation
Invocation can be done in a single call by referencing the tcast object along with the method needed and the input needed by that method. For example:
out = @tcast.toint32(input)
would convert the value or string contained in the "input" object to a 32-bit integer (int32) value.
Conversion Methods
The following methods can be used on most numeric, string, cell, and DataSet object data types:
.tostring() |
converts to a string (a.k.a. character array) |
.tological() |
converts to a logical (boolean) value |
.todouble() |
converts to a double-precision (64-bit) floating point value |
.tosingle() |
converts to a single-precision (32-bit) floating point value |
.toint8()
|
converts to a signed or unsigned 8-bit integer value |
.toint16()
|
converts to a signed or unsigned 16-bit integer value |
.toint32()
|
converts to a signed or unsigned 32-bit integer value |
.tocell() |
converts to a cell array (most types convert into a cell array with a single cell element containing all values) |
.todataset()
|
converts to a DataSet object. |
.totranspose() |
special does not change data type, but swaps rows and columns of any two-dimensional array (i.e. returns the transpose). |