Error in comparison of a binary with CVX variable

In the following code the input A is a vector of 0 and 1.

  function SolverFor3R(A)
        cvx_begin quiet
            cvx_solver MOSEK
            variable W(n) 
            subject to
                for i=1:n

If all elements of A are zero, the problem is solved without any problem. However, if one element becomes 1 then CVX return the following error:

Error using cvxprob/newcnstr (line 61)
Invalid CVX constraint: {cvx} >= {logical}

Error in  >=  (line 21)
b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '>=' );

Error in SolverFor3R (line 139)

Apparently your A is logical, but needs to be numeric to use in a CVX constraint

I believe W >= double(A) will work. There is no need to use a for loop in your example.