# Definition of expression holder within an internal function

Dear CVX Community,

I am trying to implement an optimization problem where the 2D inverse wavelet transform is used to recover an image (one of the optimization variables is the wavelet coefficient vector), and for this I am using the function IWT2_PO() from the Wavelab library. When I run my optimization program I get the message “Conversion to double from cvx is not possible”. According to the rest of the message, the cause is this instruction in the function UpSampleN() used within IWT2_PO(): y(1:s:(n-s+1) )=x. The variable x is a CVX variable but the variable y is a numeric and local variable of UpSampleN(). Following the CVX’s User Guide I put the following line within UpSampleN(): expression y(1,N), but after running the program I get the message: “No CVX model exists in this scope”, and when I put the same line just after the definition of my optimization variables I again get the message “Conversion to double from cvx is not possible”.

How could I solve this problem? Any help would be greatly appreciated!

Give this a shot: add this line before hand:

``y = cvx(y);``

Thanks to mcg for his reply, his solution works for that specific error. As part of the code of the function IWT2_PO(), there is this call to the built-in MatLab filter() function:

``````ypadded = filter(f,1,xpadded);
``````

where xpadded is a subarray taken from a CVX optimization variable. When my program reaches that point, I get this error message: “Undefined function or method ‘filter’ for input arguments of type ‘cvx’”.

How could I solve this error? How could I create a numerical (not cvx) variable from a cvx variable? Thanks in advance.

PD: I did not create a new post with this question since I think this is highly related with the original question.

I’m afraid filter() simply isn’t implemented for CVX. The list of functions in the documentation is exhaustive. Of course, filter is a linear operation, so you can construct the equivalent matrix multiplication if you wish.