Here is the simplified code:

for k=1:1:50

cvx_begin

variable x

minimize f(x+c(k))

subject to

x>=0;

cvx_end

end

The code is just a sample to describe my problem. Now I want to know if in the k_th loop, the program will report an error when the problem was not successfiully solved ,because the problem itself has no solution. Now I want to skip the errors and let the program continue and return a NaN value to get my emulated image. I used the ‘try’ function to try it but It’s not feasible.Please give me some advice ,thanks .