Borrar filtros
Borrar filtros

Selecting points from a matrix

7 visualizaciones (últimos 30 días)
Jen
Jen el 18 de Jun. de 2018
Comentada: Jen el 18 de Jun. de 2018
I'm trying to select certain points from a very large matrix using Matlab that fall in a value range and make the rest of the values zeroed in that matrix. The matrix is about 500x500 and I only want values between 9 and 10 to show and everything else zeroed. Please let me know if this is possible/ if you can help? Thanks!

Respuesta aceptada

Paolo
Paolo el 18 de Jun. de 2018
x = [9,10,3,2,6;3,1,7,8,10];
x =
9 10 3 2 6
3 1 7 8 10
x(x<9 | x>10) = 0;
x =
9 10 0 0 0
0 0 0 0 10

Más respuestas (1)

Matt J
Matt J el 18 de Jun. de 2018
Editada: Matt J el 18 de Jun. de 2018
If A is your matrix
A( A<9 | A>10)=0 ;

Categorías

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

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by