MATLAB: Detecting Entire Column has the same integer value

same integer

Hello, I need to determine whether the entire row has the same integer value. For example;
A=[1 1;
1 0.5;
1 0.5]; The first column is all ones. Therefore, I need ans = [1 0]
However,
A=[0.5 -1
0.5 0
0.5 1]; The first column is all 0.5. I need ans = [0 0]

Best Answer

Try this:
if a(:,1)==a(1,1)&mod(a(1,1),1)==0
Ans=[1 0];
else
Ans=[0 0];
end