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

조회 수: 3 (최근 30일)
marie
marie 2012년 12월 4일
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?

채택된 답변

Image Analyst
Image Analyst 2012년 12월 4일
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)

추가 답변 (1개)

Walter Roberson
Walter Roberson 2012년 12월 4일
Any value that is <= 2 will also be <= 6 . Reconsider your comparisons.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by