Files
mql5-skills/skills/mql5/references/docs/06-matrix/0288-matrix-matrix-initialization-matrix-zeros.md
T
2026-06-23 21:47:51 +08:00

759 B

Zeros

This is a static function that creates and returns a new matrix filled with zeros.

static matrix matrix::Zeros(
  const ulong  rows,     // number of rows
  const ulong  cols      // number of columns
   );
 
static vector vector::Zeros(
  const ulong  size,     // vector size
   );
 

Parameters

rows

[in]  Number of rows.

cols

[in]  Number of columns.

Return Value

A new matrix of given rows and columns, filled with zeros.

MQL5 example:

  matrix zeros=matrix::Zeros(3, 4);
  Print("zeros = \n", zeros);
/*
zeros = 
   [[0,0,0,0]
    [0,0,0,0]
    [0,0,0,0]]
*/

Python example:

np.zeros((2, 1))
array([[ 0.],
       [ 0.]])