isbanded

Determines if the input is a banded matrix.

Syntax

b = isbanded(x, lower, upper)

Inputs

x
The object to check.
Type: any input
lower
The number of lower diagonals.
Type: integer
Dimension: scalar
upper
The number of upper diagonals.
Type: integer
Dimension: scalar

Outputs

b
A logical 1 when x is a banded matrix, and 0 otherwise.
Type: Boolean

Example

m = diag(ones(1,10), 12, 10);
m(3, 7) = 1;
b = isbanded(m, 4, 3)
b = 1