Borrar filtros
Borrar filtros

replacing components of a matrix

1 visualización (últimos 30 días)
Charlene
Charlene el 8 de Mayo de 2013
how to generate a matrix that replaces all components of a previous matrix lying between 2.9 and 3.2, by -1?

Respuesta aceptada

Matt Kindig
Matt Kindig el 8 de Mayo de 2013
%your matrix is M
isBetween = (M >= 2.9) & (M <= 3.2);
M(isBetween) = -1
  1 comentario
Charlene
Charlene el 8 de Mayo de 2013
thx a lot however an other problem turned up; the other components that are not int between the interval became 0, while i need them to be equal as the previous matrix which is (A=random('norm',3,0.2,100,100))

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing 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!

Translated by