フィルターのクリア

Comparing two matrix per greater or equal to

1 回表示 (過去 30 日間)
DP
DP 2018 年 9 月 30 日
編集済み: jonas 2018 年 9 月 30 日
I have matrix A which is 1x276 and B which is 1x503305. I want to count how many values from B are greater or equal to each value of A. How would I do this?
Thanks!

採用された回答

jonas
jonas 2018 年 9 月 30 日
編集済み: jonas 2018 年 9 月 30 日
arrayfun(@(x)sum(x>=B),A)

or perhaps I am reading it wrong and you need to swap A for B and vice versa

  2 件のコメント
DP
DP 2018 年 9 月 30 日
I had to swap A for B, but this is correct! I learned a new function today, thanks!
jonas
jonas 2018 年 9 月 30 日
編集済み: jonas 2018 年 9 月 30 日
Happy to help! :)
Arrayfun is basically a nicer way to loop over the elements of an array. Note that it is often slower than looping, so if you have very large data sets you may want to loop instead.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by