- A > B
- A > 0
How to take positive value from logical command
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ahmad Bayhaqi
le 29 Avr 2021
Commenté : Ahmad Bayhaqi
le 2 Mai 2021
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/601595/image.png)
0 commentaires
Réponse acceptée
the cyclist
le 29 Avr 2021
Modifié(e) : the cyclist
le 29 Avr 2021
I'm not sure I know what you mean. Do you mean you only want true if both the following criteria are met?
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));
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Types dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!