title: Update the number of nonlinear constraints in fmincon in Matlab
body: <p>I am trying to use <code>fmincon</code> in a <code>while</code> loop such that until the <code>while</code> condition is not satisfied, <code>fmincon</code> must be executed. Each time <code>fmincon</code> can't satisfy a specific condition (e.g., <code>x(N)-7.6==Tol</code>), the number <code>N</code> of nonlinear constraints should be updated (increased). How is this possible with <code>fmincon</code>?
  Suppose I initially have 18 nonlinear equality equations (<code>ceq(1)</code> ... <code>ceq(18)</code>). When the <code>while</code> condition can't be satisfied, the number of nonlinear equality equations should be increased to 23 (<code>ceq(1)</code> ... <code>ceq(23)</code>) on the next iteration. </p>
  
  <p>tnx for your innovative idea....let's give you more details about what I wanna do. I have some set of nonlinear algebraic equations so that I need to work with NLP (nonlinear programming) solvers. besides my cost function is minimum time problem. actually my nonlinear constrained equations are some dynamic governing equations which are discreticized in time coordinate. N is the number of discretization. based on Lagrange optimization technique, for finding optimal solution, gradient of scalar function(Lagrangian) should be added to system. as I mentioned in my question I need to test my problem with an initial N, then if the Xoutput of fmincon could'nt meet the constrained, it needs to increase the number of descritization. it continues, until the output optimal answer of fmincon get closed enough to my desired answer.</p>