matinit

Purpose

Allocates a matrix with a specified fill value.

Format

y = matinit(r, c, v)
Parameters:
  • r (scalar) – rows.
  • c (scalar) – columns.
  • v (scalar) – value to initialize.
Returns:

y (RxC matrix) – with each element equal to the value of v.

Examples

// Set print format
format /rd 6,2;

// Allocate a 3x4 matrix
// and set elements to be
// pi
print matinit(3, 4, pi);

  3.14   3.14   3.14   3.14
  3.14   3.14   3.14   3.14
  3.14   3.14   3.14   3.14

See also

Functions matalloc(), ones(), zeros(), eye()