Date: Feb 11, 2005 6:54 PM
Author: mehrnoush
Subject: Re: Return column index (easy question)

try this:

find(v==max(max(d)));

/M

Tim Booher wrote:
>
>
> I am trying to return a maximum eigenvalue and its associated
> eigenvector, but can't because I don't know how to find the column
> number associated with the maximum eigenvalue. For example,
>
> [v d]=eig([1 2 3; 4 5 6; 7 8 9]);
>
> max_eig_val=max(max(d));
> max_eig_vec=v(:,??);
>
> What can I put in for ??. ColumnIndex(max(max(d))) would be great
> if
> it existed.
>
> Any ideas??
>
> Thanks so much,
>
> Tim