how to implement the function argmax in cvx

After cvx_end, and presuming the solver successfully solves the problem, then the optimization variables will contain the optimal argument values.

So if variable X(3) and the objective is minimize(some function of X), then after the solver solves the problem, the vector X will be the argmin. Similarly in the case of argmax for maximize.

argmin/argmax are not convex or concave. CVX cannot support them. (Though if Mark’s interpretation of your question is correct, that’s fine. :-))

Ahh yes, I see how the OP could have been asking for something other than my interpretation. While it is true that argmin and argmax are not generally convex or concave functions of their input argument(s) (parameters), they could be in some cases, even though not amenable to formulation in CVX.

(continuation of comment above) That is, without “pre-solving” them outside CVX, rendering CVX’s contribution in the optimization process to be de minimis.