Borrar filtros
Borrar filtros

Using the find function

1 visualización (últimos 30 días)
Anthony
Anthony el 20 de Abr. de 2012
A= magic(4)
for z= 1:4
position(z) = find(A(:,z)>10,1)
end
I want to use the find function to find all the values greater than 10 . this will enable me use the command A(position) to get all the values greater than 10 in a matrix. Is this possible with matlab?

Respuesta aceptada

Thomas
Thomas el 20 de Abr. de 2012
A= magic(4)
[row,col]=find(A>10)
should give you all positions of values in a Which are > 10
To find the actual values in A which are > 10 use
A(A>10)
ans =
16.00
11.00
14.00
15.00
13.00
12.00

Más respuestas (1)

Anthony
Anthony el 20 de Abr. de 2012
Thank you Thomas. The reason I am looking for the position is because I want to use these positions to access other values in a matrix named Zone. Zone is defined by: Zone = [3 5 7 9; 4 7 8 2; 4 6 7 8; 5 1 3 2]
So how do I relate the positions from A to the values I want in Zone? basically what I want from Zone is [3,7,1,3,9,8]. Is this possible?
  1 comentario
Thomas
Thomas el 20 de Abr. de 2012
Zone(A>10)
should do the trick..

Iniciar sesión para comentar.

Categorías

Más información sobre Simulink 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