Q:

How to write the constraints in CVX not using a loop

I'm using the matlab package "CVX" to solve an optimization problem. Currently I'm using a for loop to add the constraints, but I found that it is extremely slow when initializing the problem.
for i=1:n
    norm(Nout(i,:)-Nin(i,:))<=tau;
end

Nout and Nin is two matrix of size n*3, and I need the norm of each row of the matrix Nout-Nin is smaller than a threshold, how could I write this without loops? Thanks!

A:

You can compute the norm manually:
result = sqrt(sum((Nout - Nin) .^ 2, 2)) <= tau

