replacing components of a matrix

조회 수: 2 (최근 30일)
Charlene
Charlene 2013년 5월 8일
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에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by