How to take positive value from logical command

1 回表示 (過去 30 日間)
Ahmad Bayhaqi
Ahmad Bayhaqi 2021 年 4 月 29 日
コメント済み: Ahmad Bayhaqi 2021 年 5 月 2 日
Hi All
I have two data A and B and want to do logical command for them; A is bigger than B. However, I want to take "true" result from the positive "A"
Is there a way to do it?
Thank you

採用された回答

the cyclist
the cyclist 2021 年 4 月 29 日
編集済み: the cyclist 2021 年 4 月 29 日
I'm not sure I know what you mean. Do you mean you only want true if both the following criteria are met?
  • A > B
  • A > 0
If that is what you mean, then
output = (A>B) & (A>0);
If you mean you want the positive values of A, where A is also larger than B, then
output = A((A>B) & (A>0));
  1 件のコメント
Ahmad Bayhaqi
Ahmad Bayhaqi 2021 年 5 月 2 日
Thank you very much,
It works for me

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Types についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by