Selecting points from a matrix

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!

 採用された回答

Paolo
Paolo 2018 年 6 月 18 日

0 投票

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

1 件のコメント

Jen
Jen 2018 年 6 月 18 日
Thank you, this worked!

サインインしてコメントする。

その他の回答 (1 件)

Matt J
Matt J 2018 年 6 月 18 日
編集済み: Matt J 2018 年 6 月 18 日

0 投票

If A is your matrix
A( A<9 | A>10)=0 ;

1 件のコメント

Jen
Jen 2018 年 6 月 18 日
Thank you!

サインインしてコメントする。

カテゴリ

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

製品

質問済み:

Jen
2018 年 6 月 18 日

コメント済み:

Jen
2018 年 6 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by