diagonal
by Miguel D. B.
11 Mar 2006
(Updated 14 Mar 2006)
Returns a vector with the main diagonal of a matrix. Similar to the built-in function diag
|
Watch this File
|
| File Information |
| Description |
This file contians a function named "diagonal01" which isolates in a row vector the diagonal of a matrix (square or not), whitout using a loop. It is similar to the Matlab built-in function "diag" when used with one input argument.
For example, the instructions
» A=magic(4); A(end,:)=[], B=diagonal01(A)
Produce
A =
16 2 3 13
5 11 10 8
9 7 6 12
B =
16 11 6 |
| MATLAB release |
MATLAB 5.3 (R11)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Comments and Ratings (9) |
| 14 Mar 2006 |
Jos x
|
|
|
| 14 Mar 2006 |
dave martin
|
|
|
| 15 Mar 2006 |
Vassili Pastushenko
|
|
|
| 15 Mar 2006 |
Jos x
|
|
|
| 15 Mar 2006 |
Vassili Pastushenko
|
|
|
| 15 Mar 2006 |
Vassili Pastushenko
|
|
|
| 15 Mar 2006 |
Vassili Pastushenko
|
|
|
| 11 Oct 2007 |
Edmund Brekke
|
|
|
| 11 Oct 2007 |
Edmund Brekke
|
|
|
|
Contact us at files@mathworks.com