Matlab判断一个数值的奇偶性

if mod(x, 2) == 0
% number is even
else
% number is odd
end

原文地址:https://www.cnblogs.com/avin/p/7871693.html