Skip to main content

MUNIT

Returns the unit matrix for the specified dimension.

Syntax

expression.MUNIT(arg1);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters

NameRequired/OptionalData typeDefaultDescription
arg1RequiredApiRange | ApiName | numberAn integer specifying the dimension of the unit matrix to be returned.

Returns

number

Example

Return the unit matrix for the specified dimension in a spreadsheet.

// How to get an unit matrix in a spreadsheet.

// Use a function to get an unit matrix specifying dimension in a spreadsheet.

let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("A1").SetValue(func.MUNIT(3));