How do I check to see if the elements in a matrix are all equal?

49 ビュー (過去 30 日間)
katherine keogh
katherine keogh 2020 年 9 月 11 日
コメント済み: madhan ravi 2020 年 9 月 11 日
So if I have matrix A=[1 1 1 ; 1 1 1 ; 1 1 1] I would like to run a check so check if all the elements in the matrix are the same. Or say matrix B = [1, 0 1; 0 1 0; 1 1 0] I would liek to run a check to see if the elements are all the same ( in this case they aren't).

採用された回答

madhan ravi
madhan ravi 2020 年 9 月 11 日
a = num2cell(A);
isequal(a{:})

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by