0th norm in cvx or number of non-zero elements

I have a condition says 0th norm = no. of non-zero elements of w = 5
how I can implement it in cvx?

You’ll have to use the mixed integer DCP (MIDCP) capability of CVX, if it can be done. It may require some effort on your part, which will depend on the context.