How to store the object function output values to an array? [When I try to run it inside a for loop multiple time]

How to store the object function output values to an array? [When I try to run it inside a for loop multiple time]

After cvx_end, cvx_optval contains the value of the objective function. So set the array entry for that for loop iteration to cvx_optval, before beginning the next for loop iteration.