I am a new user, also wondering if cvx could be made compatible with nested functions. If you have any nested functions in your code, then your workspace is static and cvx's calls to assignin() and evalin() cause a series of errors.
To hopefully overcome this, one by one I initialized variables in my nested code:
% problem setup
m = 16; n = 8;
A = complex(randn(m,n),randn(m,n));
b = complex(randn(m,1),randn(m,1));
% local initializations
x = ; % decision variable
cvx_problem = ;
cvx_status = ;
cvx_optval = ;
cvx_optbnd = ;
cvx_slvitr = ;
cvx_slvtol = ;
cvx_cputime = ;
Aeq = ;
pop = @() 0;
variable x(n) complex
minimize( norm(A*x-b) )
Actually, this got me pretty far. The problem is entered and solved. But... pop() throws a curveball. pop() is a method found in cvx/lib/@cvxprob. It's called by cvx_end.m as evalin('caller','pop(...)'). So, I tried two things:
- copied pop.m to the local dir
- added assignin('caller','pop',@pop) to cvx_end.m before the evalin().
For some reason, doing either of these caused matlab to crash instantly (segmentation violation).
So, I gave up. Maybe it's just my machine and it will work for others, or perhaps someone could solve the problem with pop()?
PS As a new user I have to say wow, CVX is really nice!