how to extract the diagonal entries out of a matrix
David Doria
daviddoria at gmail.com
Fri Feb 6 12:02:49 CST 2009
A = rand(3,3);
B = diag(A);
Dave
On Fri, Feb 6, 2009 at 1:01 PM, Edward <edatva at gmail.com> wrote:
> Hi,
>
> For example, there is a matrix like:
>
> [ 1 2 3 4
> 5 6 7 8
> 3 5 7 0
> 4 8 2 5 ]
> and I want to get the diagonal elements out of the matrix and make into a
> vector: [ 1 6 7 5] .
>
> I know I could write some lines to do it, but I just want to know if there
> is a built-in function can do the job. Thank you.
>
> --
> Edward
>
> _______________________________________________
> Help-octave mailing list
> Help-octave at octave.org
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>
>
--
Thanks,
David
More information about the Help-octave
mailing list