Contents Previous Next Subchapters Current Chapters-> identity zeros ones fill fillcols fillrows seq toeplitz vander hankel hilb invhilb diag tril triu novalue Parent Chapters-> Omatrix6 elementary specialmatrices fill Search Tools-> contents reference index search

Filling A Matrix With Copies of Another Matrix
 Syntax z` = fill(`x`, `m`, `n`)` z` = fill(`x`,`[m , n]`)` See Also repmat , ones , zeros , fillrows , fillcols

Description
Returns a matrix z with `m x n` subblocks each of which is equal to x. The return matrix has the same type as x, has m times as many rows as x and n times as many columns as x. The (i,j)-th element of the return value is given by ```      z    = x      i,j     mod(i-1,m)+1 , mod(j-1,n)+1  ```The arguments m and n can be integer, real, or double-precision. If they are not integer, only their integer .

Example
For a scalar x example, enter ```      fill(1.5, 2, 3) ``` which returns ```      {      [ 1.5 , 1.5 , 1.5 ]      [ 1.5 , 1.5 , 1.5 ]      } ``` For a matrix x example, enter ```      fill([2.5 , 3.5], [2, 2]) ``` which returns ```      {      [ 2.5 , 3.5 , 2.5 , 3.5 ]      [ 2.5 , 3.5 , 2.5 , 3.5 ]      } ```
Empty Matrices
You can use the fill command to create empty matrices. If you enter ```      x = fill(1, 0, 3)      print type(x), rowdim(x), coldim(x) ``` O-Matrix will respond ```      int 0 3 ```
Mlmode
In Mlmode , this function is called `repmat` instead of `fill`. If in Mlmode you enter, ```      repmat([2.5 , 3.5],  [2 , 2]) ``` which returns ```      {      [ 2.5 , 3.5 , 2.5 , 3.5 ]      [ 2.5 , 3.5 , 2.5 , 3.5 ]      } ```