Selecting points from a matrix

7 次查看(过去 30 天)
Jen
Jen 2018-6-18
评论: Jen 2018-6-18
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
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 个)

Matt J
Matt J 2018-6-18
编辑:Matt J 2018-6-18
If A is your matrix
A( A<9 | A>10)=0 ;

类别

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

产品

Community Treasure Hunt

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

Start Hunting!

Translated by