How to check if all of the elements in an array are the same, in matlab?
matlab
Solution
I think it can be as simple as
if all(v == v(1))
Another method would be
if range(v) == 0
Problem
There must be a simple matlab way of doing this. I have a row vector and I want to check if all of the elements are equal. Brute forcing this in a loop is easy, but looking for a more efficient approach :) The elements are integers