# Diagonal indices 1.0

OS : Windows / Linux / Mac OS / BSD / Solaris

Script Licensing : Freeware

Created : Aug 27, 2007

Downloads : 2

Thank you for voting...

## Have you ever wanted to change a diagonal of a square ...

Have you ever wanted to change a diagonal of a square matrix? You may try this solution: (for example for changing 2nd diag above the main diag)

p(find(diag(p, 2))=0;

But this m file is considerably faster.

I: linear indices of the kth diagonal.

n: order of a square matrix

k:

k=0 : main diagonal (default)

k>0 : kth diagonal above the main diag

p(find(diag(p, 2))=0;

But this m file is considerably faster.

**Usage:**

I=diagind(n, k)I: linear indices of the kth diagonal.

n: order of a square matrix

k:

k=0 : main diagonal (default)

k>0 : kth diagonal above the main diag

**Diagonal indices 1.0 scripting tags:**matlab indices, matlab mathematics, diagonal indices, file, kth, square, diagpfinddiagpbut.

**What is new in Diagonal indices 1.0 software script?**- Unable to find Diagonal indices 1.0 news.

**What is improvements are expecting?**Newly-made Diagonal indices 1.1 will be downloaded from here. You may download directly. Please write the reviews of the Diagonal indices. License limitations are unspecified.