How to know the location of the minimun value from a vector?

2 visualizaciones (últimos 30 días)
I have a vector like this: A =
0.2008 0.2011 0.2011 0.1979 0.2003
then the minimun value is: 0.1979 which located on (1,4)
So I want to take the location of that value like above. What to do? Thanks before :')

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 6 de Mayo de 2012
A = [0.2008 0.2011 0.2011 0.1979 0.2003]
[c,idx] = min(A)
for matrix
eg:
A = rand(8);
solution:
[vc,irows] = min(A);
[v,icols] = min(vc);
out = [v irows(icols) icols];
or:
v = min(A(:));
[irows,icols] = find(A == v);
or:
[v,ii] = min(A(:));
[irows,icols] = ind2sub(size(A),ii);

Más respuestas (1)

zhenqiang
zhenqiang el 6 de Mayo de 2012
good learning

Categorías

Más información sobre Elementary Math en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by