There are some suggestions to use bsxfun in cvx on this forum, but anytime I try to use it within the environement I receive the “Undefined function or method ‘bsxfun’ for input arguments of type ‘cvx’.” Error. Is there a workaround for this function, or am I just going to have to perform a loop to subtract a vector from each column of a matrix?

Yes, `bsxfun`

is a very useful function, but it has not been implemented for CVX objects. However, that does not mean you have to use a loop, and indeed you certainly never should.

For instance, consider this:

```
cvx_begin
variable X(n,n)
variable y(n)
```

and suppose you want to subtract `y`

from each column of `X`

. Then you can do this:

`X - y(:,ones(1,n))`