Hello!

I have an convex optimization problem which I use MATLAB and CVX for and as long as I do this simply in MATLAB alone, everything works like a charm. Now the problem is, I need my MATLAB functions available in C#, so I compile a library of my code. As long as I use only functions from my library which do not use CVX, all is fine.

The problem now lies in the combination of everything, when I want to use functions from my library which make use of CVX. I get the following error:

*Attempt to reference field of non-structure array.*

at cvx_global.m, line 76. (osolvers = cvx___.solvers.list;)

at cvxprob.m, line 4.

at cvx_begin.m, line 41

I suspect (and I didn’t use CVX for long, so my thought might go into the totally wrong direction) that the MATLAB compiler uses all cvx .m files which my files depend on and then compiles those and includes them in the library. But maybe some files/data is lost in this structure that was setup when doing cvx_setup?

Do I need to inlcude some additional special files?

Using cvx_setup from within my library also results in:

…

Searching for solvers…

UNEXPECTED ERROR: --------------------------------

Attempt to reference field of non-structure array.

Error in cvx_setup (line 114) (nrej = sum(~cellfun(@isempty,{solvers.error}))

…

This is really important for my project, so any help will be super appreciated!