replacing components of a matrix

1 次查看(过去 30 天)
how to generate a matrix that replaces all components of a previous matrix lying between 2.9 and 3.2, by -1?

采纳的回答

Matt Kindig
Matt Kindig 2013-5-8
%your matrix is M
isBetween = (M >= 2.9) & (M <= 3.2);
M(isBetween) = -1
  1 个评论
Charlene
Charlene 2013-5-8
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))

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by