Building Functions using CVX

Perhaps you can do what you want using MATLAB strings. So pass a string into your function and/or modify/build up the string as needed (for instance with numerical values), using strcat, sprintf, or whatever. . Then eval the string inside CVX. Here is a simple example showing that it works.

k = 4.14587;
joeblow = sprintf(‘x >= %g’,k);
cvx_begin
variable x
minimize(x)
eval(joeblow)
cvx_end

Calling SeDuMi 1.34: 1 variables, 1 equality constraints

SeDuMi 1.34 (beta) by AdvOL, 2005-2008 and Jos F. Sturm, 1998-2003.
Alg = 2: xz-corrector, Adaptive Step-Differentiation, theta = 0.250, beta = 0.500
Split 1 free variables
eqs m = 1, order n = 3, dim = 3, blocks = 1
nnz(A) = 2 + 0, nnz(ADA) = 1, nnz(L) = 1
it : by gap delta rate t/tP t/tD* feas cg cg prec
0 : 7.19E+00 0.000
1 : 4.19E+00 2.00E-01 0.000 0.0278 0.9900 0.9900 0.51 1 1 1.6E-01
2 : 4.15E+00 8.13E-06 0.000 0.0000 1.0000 1.0000 0.99 1 1
iter seconds digits cx by
2 0.0 Inf 4.1458700000e+00 4.1458700000e+00
|Ax-b| = 1.1e-15, [Ay-c]_+ = 0.0E+00, |x|= 1.0e+01, |y|= 1.0e+00

Detailed timing (sec)
Pre IPM Post
6.005E-03 1.400E-02 9.958E-04
Max-norms: ||b||=4.145870e+00, ||c|| = 1,
Cholesky |add|=0, |skip| = 0, ||L.L|| = 1.

Status: Solved
Optimal value (cvx_optval): +4.14587