find the values of a that are between 2 and 6(inclusive)

3 views (last 30 days)
A>>
7.24 0.80 *7.31* *9.24* *3.09*
1.06 0.06 *8.97* *1.37* *0.55*
8.67 8.88 *9.92* *0.71* *0.90*
3.45 9.01 *9.15* *4.80* *2.29*
4.56 5.16 *5.33* *7.10* *7.61*
1.16 0.64 *0.08* *8.76* *8.06*
8.96 6.23 *9.96* *6.93* *7.71*
8.15 6.84 *6.95* *1.88* *7.36*
4.75 1.54 0.28 3.10 9.04
[r,c]=find(A<=2 & A<=6) is this right?

Accepted Answer

Image Analyst
Image Analyst on 4 Dec 2012
Some things to try:
A=[7.24 0.80 7.31 9.24 3.09
1.06 0.06 8.97 1.37 0.55
8.67 8.88 9.92 0.71 0.90
3.45 9.01 9.15 4.80 2.29
4.56 5.16 5.33 7.10 7.61
1.16 0.64 0.08 8.76 8.06
8.96 6.23 9.96 6.93 7.71
8.15 6.84 6.95 1.88 7.36
4.75 1.54 0.28 3.10 9.04]
linearIndexes = A>=2 & A<=6;
[rows, columns]=find(linearIndexes)
inRange = A(linearIndexes)

More Answers (1)

Walter Roberson
Walter Roberson on 4 Dec 2012
Any value that is <= 2 will also be <= 6 . Reconsider your comparisons.

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!