Matrix
- create a new matrix

Matrix functions
(AmiBroker 60)


SYNTAX Matrix( rows, cols, initvalue, increment = 0 )
RETURNS Matrix
FUNCTION The function creates a new matrix of user specified dimensions with all elements filled with initvalue. An optional parameter 'increment' that allows to create a matrix with monotonically increasing elements.

To create a matrix use

my_var_name = Matrix( rows, cols, initvalue)

To access matrix elements, use:

my_var_name[ row ][ col ]

where
row is a row index (0... number of rows-1)
and
col is a column index (0... number of columns-1)

Matrices and their elements support all scalar (element-wise) arithmetic and logical operations

So you can for example add, subtract, multiply, divide two matrices if they have same dimensions with one call.

EXAMPLE
x = Matrix( 5, 6, 9 ); // matrix 5 rows 6 columns, initial value 9
y = Matrix( 5, 6, 10 ); // matrix 5 rows 6 columns, initial value 10

z = y - z; // will give you matrix 5 rows and 6 columns filled with elements holding value 1 (difference between 10 and 9).
SEE ALSO

References:

The Matrix function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.