solver.generate('cg_demo',struct('mex',true));
mex cg_demo.c -DMATLAB_MEX_FILE
cg_demo('solver')
Where originally in the MATLAB code, the solver is defined as:
nlp_prob = struct('f', obj, 'x', OPT_variables, 'g', g, 'p', P);
solver = nlpsol('solver', 'sqpmethod', nlp_prob);
In the given scenario, I get an error if I try to pass upper and lower bounds for constraint vector 'g' and parameters p. cg_demo('solver') expects an argument of size OPT_variables.