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 日

0 投票

%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 件)

カテゴリ

ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by