- Index
- »
- math
- »
- func:toMatrix
def
func:toMatrix
toMatrix(obj, opts: {})
Convert a general grid to an optimized matrix grid. Matrixs are two dimensional grids of Numbers. Columns are named "v0", "v1", "v2", etc. Grid meta is preserved, but not column meta. Numbers in the resulting matrix are unitless; any units passed in are stripped.
The following options are supported:
- nullVal (Number): replace null values in the grid with this value
- naVal (Number): replace NA values in the grid with this value
toMatrix(grid, {nullVal: 0, naVal: 0})
To create a sparse or initialized matrix you can pass a Dict with the the following tags (all required)
toMatrix({rows:10, cols: 1000, init: 0})