Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Matrix.ConvertDataType

Converts the data types.

Component Version macOS Windows Linux Server iOS SDK
Matrix 12.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Matrix.ConvertDataType"; MatrixRef; DataType { ; firstRow; lastRow; firstCol; lastCol } )   More

Parameters

Parameter Description Example Flags
MatrixRef The matrix reference number. $matrix
DataType The new data type.
Can be Number, Container, Date, Time, TimeStamp or Text.
"Text"
firstRow The index of first row.
Default is 0.
0 Optional
lastRow The index of last row.
Default is Matrix.Height-1.
5 Optional
firstCol The index of first column.
Default is 0.
0 Optional
lastCol The index of last column.
Default is Matrix.Width-1.
6 Optional

Result

Returns OK or error.

Description

Converts the data types.
We loop over all rows in all columns for the range and convert the value to the given type.

Examples

Try this function:

Set Variable [ $matrix ; Value: MBS( "Matrix.New"; 3; 3 ) ]
Set Variable [ $r ; Value: MBS( "Matrix.SetColumn"; $matrix; 0;"15¶07¶92" ) ]
# get value
Set Variable [ $v1 ; Value: MBS( "Matrix.GetValue"; $matrix; 0; 0 ) ]
Set Variable [ $d1 ; Value: MBS( "FM.DataType"; $v1) ]
Set Variable [ $r ; Value: MBS( "Matrix.ConvertDataType"; $matrix; "number"; 0; 2; 0; 2) ]
# get value
Set Variable [ $v2 ; Value: MBS( "Matrix.GetValue"; $matrix; 0; 0 ) ]
Set Variable [ $d2 ; Value: MBS( "FM.DataType"; $v2) ]
# stop here to read in debugger
# $d1 shows text and $d2 shows number as type
Set Variable [ $v2 ; Value: MBS( "Matrix.Release"; $matrix) ]

See also

Release notes

Blog Entries

This function checks for a license.

Created 9th October 2022, last changed 9th October 2022


Matrix.Clone - Matrix.CopyColumn