Documentation/Calc Functions/MUNIT

Function name:
MUNIT

Category:
Array

Summary:
Returns the unitary square array of a certain size. The unitary array is a square array where the main diagonal elements equal 1 and all other array elements are equal to 0.

Syntax:
MUNIT(Dimensions)

Arguments:
Dimensions refers to the size of the array unit.

Examples:
Select a square range within the spreadsheet, for example, from A1 to E5.

Without deselecting the range, select the MUNIT function. Mark the Array check box. Enter the desired dimensions for the array unit, in this case 5, and click OK.

You can also enter the =MUNIT(5) formula in the last cell of the selected range (E5), and press Shift + Ctrl + Enter.

You now see a unit array with a range of A1:E5.

More explanations on top of this page.