Mad function erorr

All the supported functions are listed in the CVX Users’ Guide. mad is not among them.

Before trying to reformulate for CVX, make sure the problem is convex, which is your responsibility.

Anyhow, I think this is what you want:
sum(abs(z-sum(z)/10))/10 or norm(z-sum(z)/10,1)/10

I believe mean(z) should be allowed, but I am getting an error message. But the preceding should work.