dpb
Posts:
8,152
Registered:
6/7/07


Re: Index for max element in a matrix?
Posted:
Jun 10, 2008 6:57 PM


saneman wrote: > I have this matrix: > > A = [15 12 11; > 20 44 23; > 33 32 34]; > > > Is there a function in matlab that returns the x and y index for the > maximum/minimum element? In this case the function should return (2,2). > > If I use: > > find(A==(max(max(A)))) > > I just get 5.
ind2sub(size(A),5)


