How to find the row and column of the largest number in an array?
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Prerna Mishra
el 15 de Jul. de 2022
Respondida: Chunru
el 15 de Jul. de 2022
Hello,
I am new to matlab and I am stuck with this. If I have a matrix A as follows:
4.4347 4.5156
4.462 4.7074
1.111 .985
I want (2,2) for index and 4.707 for value. I am trying the following:
A = [4.4347 4.5156; 4.462 4.7074;1.111 .985 ]
max(A,[],1,'linear')
and
max(A,[],2,'linear')
But I don'g get the desired answer with either of them. Any help pwuld be greatly appreciated!
0 comentarios
Respuesta aceptada
Chunru
el 15 de Jul. de 2022
A = [4.4347 4.5156; 4.462 4.7074;1.111 .985 ]
[Amax, idx] = max(A(:))
[i, j] = ind2sub(size(A), idx)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!