Find elements greater than a value corresponding to the second array

Hi,
I have matrix A which has zeros and precipitation values and B which has zeros and probability values. The probability values (nonzero values) in B correspond to the nonzero precipitation values in A. I need to extract values from A, for greater than a probability value from B. Which means look for probability value greater than 0.875 (for example 0.875) from B and get the corresponding values from A.
Can somebody help me in this using matlab.
Thanks in advance.

 採用された回答

Cedric
Cedric 2014 年 6 月 4 日
編集済み: Cedric 2014 年 6 月 4 日

2 投票

loc = B > 0.875 ; % Logical index of elements of B greater than 0.875.
val = A(loc) ; % Values of A at locations indexed by loc.
which you can write in one statement
val = A(B > 0.875) ;

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLanguage Fundamentals についてさらに検索

質問済み:

2014 年 6 月 4 日

コメント済み:

2014 年 6 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by