You would have to introduce indicators etc to trigger various cases. One model I guess would be something like this
a = sdpvar(20,1);
pos = binvar(20,1);
neg = binvar(20,1);
Model = [pos + neg == 1, implies(a>=0,pos) + implies(a <= 0,neg), -100 <= a <= 100];
y = randn(20,1);
objective = (a-y)'*(a-y);
Model = [Model, sum(max(diff(neg),0)) <= 2];
optimize(Model,objective)
[value(pos) value(neg) value(a)]
note that the problem / model is ill-posed around zero (as you cannot have strict inequalities)