Error in using Indicator function

Hi, and thanks for creating this amazing Forum.

I am running a code which includes an Indicator function. When I use this Indicator function in my main function, I am facing the below error by CVX:
Undefined function ‘minus’ for input arguments of type ‘cvxcnst’

Also, I tried to use the “Max” function rather than the Indicator function, but the code takes a lot of times. Indeed, normally when I use any norm function it takes 20 Sec but when I use Max it takes at least 1 our or sometimes much more.

How can I use the Indicator function without facing the mentioned error.

You can’t use an indicator function applied to a CVX variable or expression. You need to do something along the lines of Big M logic modeling using CVX’s MIDCP capability - but that can get messy. Srudying may be of help.

As for the max function, if that does what you want, but is too slow, see if you can vectorize things, the same as you would do in “regular” MATLAB. Otherwise show reproducible code with an explanation of what is too slow, and your evidence for it.

Dear Stone

Many thanks for your generous help. I will definitely review the pdf file