I am trying to maximize this objective

```
variable x(n) binary
maximize(sum((S*x)>0))
subject to
lowerBound <= x <= upperBound
sum(x) == K
```

where I want the number of non zero element. This works when I use it with matlab only but it does not work with cvx. instead I get the error:

Error using sum

Invalid data type. First argument must be numeric or logical.