how to check that difference of two vectors is a multiple of ones in matlab
Afficher commentaires plus anciens
A=[2 2 2 2 ] B=[3 3 3 3 ] want to check if A-B=k(ones) where k is an integer.
2 commentaires
Stephen23
le 7 Sep 2018
"where k is an integer."
Can k be negative? Or zero? Or are only positive k allowed?
asim nadeem
le 7 Sep 2018
Réponse acceptée
Plus de réponses (1)
Alexander Jensen
le 6 Sep 2018
Modifié(e) : Alexander Jensen
le 6 Sep 2018
Is this what you're looking for?:
isInt = ~logical(mod(A-B,1))
isInt =
1×4 logical array
0 1 1 1
The logical(X) function returns everything that is not 0 as TRUE.
1 commentaire
asim nadeem
le 7 Sep 2018
Catégories
En savoir plus sur Whos dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!