How do I write the following in cvx enviornment?

X(i,j)-X(i,k)<={x(i)-x(j) if x(i)<x(j)<x(k)
               {0         if x(i)>x(j)<x(k)
               {x(i)-x(k) if x(i)<x(j)>x(k)

I seriously doubt this is convex. In particular, you cannot use variables inside if statements; and I suspect the mixture of min and max statements required to accomplish this would be nonconvex.