From: P.Y. on
Hi,

May I know how to get the index for the maximum value of the matrix as shown below please? That is the index for 4.216. Thank you.

Columns 1 through 10

3.4598 3.984 3.1433 4.216 3.719 3.7485 3.4471 2.5019 1.4215 2.1598

Columns 11 through 12

2.4248 2.4786
From: Oleg Komarov on
"P.Y. " <peiyi.lim(a)postgrad.curtin.edu.au> wrote in message <hgnc1i$41v$1(a)fred.mathworks.com>...
> Hi,
>
> May I know how to get the index for the maximum value of the matrix as shown below please? That is the index for 4.216. Thank you.
>
> Columns 1 through 10
>
> 3.4598 3.984 3.1433 4.216 3.719 3.7485 3.4471 2.5019 1.4215 2.1598
>
> Columns 11 through 12
>
> 2.4248 2.4786
read the section 'matrix indexing' of the online help of matlab to get more insight

also help max, nanmax

[value, IDX] = max(yourVector)

Oleg
From: Toby on
"P.Y. " <peiyi.lim(a)postgrad.curtin.edu.au> wrote in message <hgnbo8$g3h$1(a)fred.mathworks.com>...
> Hi,
>
> May I know how can I get the index for the maximum value, that is the index for 4.216 from a matrix as shown below, please? Thank you.
>
> Columns 1 through 10
>
> 3.4598 3.984 3.1433 4.216 3.719 3.7485 3.4471 2.5019 1.4215 2.1598
>
> Columns 11 through 12
> 2.4248 2.4786

Hello Fred,

Try to look up the functions 'max' and 'find' in the help files. Then try something like:
Index_of_max = find(A==max(A))
Where 'A' is the matrix containing your values

Toby
From: Matt Fig on
Use the second output of the max function instead of calling find.

>> [m,p] = max(A)
m =
4.216
p =
4
From: P.Y. on
"Matt Fig" <spamanon(a)yahoo.com> wrote in message <hgnq97$9b8$1(a)fred.mathworks.com>...
> Use the second output of the max function instead of calling find.
>
> >> [m,p] = max(A)
> m =
> 4.216
> p =
> 4

Thanks, this is what I am looking for.