Learn R Programming

pracma (version 1.7.9)

nnz: Nonzero Elements

Description

Number of non-zero elements.

Usage

nnz(x)

Arguments

x
a numeric or complex vector or matrix.

Value

  • the number of non-zero elements of x.

See Also

find

Examples

Run this code
nnz(diag(10))

Run the code above in your browser using DataLab