Problem with indexing CVX variable

I have a CVX variable d_F which is index of an image.

code:

variable d_f(10);

Z1 = InpImg(:,d_f);

here, InpImg is an image and I want to get all the image values at location d_f. But when I run this I get an error

Error using subsindex
Function ‘subsindex’ is not defined for values of class ‘cvx’.

Can you please tell me where I am going wrong. Can the optimization variables not be used to index. Please let me know

Many Many Thanks

You cannot use variables as indices. You will have to find a different way to model your problem.