integer is used to constrain a variable to be integer.
F = integer(x)
Setting up a integer linear program can be done as
x = intvar(n,1); optimize([A*x<=b],c'*x)
x = sdpvar(n,1); optimize([A*x<=b, integer(x)],c'*x)
The integrality constraint is imposed on the involved variables, not the actual expression. Hence, the following two constraints are equivalent.
F = integer(x); F = integer(pi+sqrt(2)*x);
If possible, use intvar instead as there are some parts in YALMIP where it can exploit integrality on an earlier stage if the varaibles have been defined as such.