how to check that difference of two vectors is a multiple of ones in matlab
古いコメントを表示
A=[2 2 2 2 ] B=[3 3 3 3 ] want to check if A-B=k(ones) where k is an integer.
2 件のコメント
Stephen23
2018 年 9 月 7 日
"where k is an integer."
Can k be negative? Or zero? Or are only positive k allowed?
asim nadeem
2018 年 9 月 7 日
採用された回答
その他の回答 (1 件)
Alexander Jensen
2018 年 9 月 6 日
編集済み: Alexander Jensen
2018 年 9 月 6 日
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.
カテゴリ
ヘルプ センター および File Exchange で Whos についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!