Can l0-norm meet the DCP in convex optimization problem?

I wonder if the constraint which defines the norm-0 of the vector equals one constant is a convex constraint. if yes, how to represent it in matlab CVX? If not, how to transform it to satisfy the DCP? Please help.

That is a nonlinear equality constraint, hence non-convex.

However, if you have Mosek or Gurobi available as solver, it can be handled using CVX’s MIDCP capability, as shown in section “9.1.7 Exact 1-norm” of the Mosek Modeling Cookbook.

Many thanks for your apply.