this is a bit dangerous.  You're violating the contract of taking the kinsol as input.  I think it's better to simply error if kinsol.mex ~= true.  There are too many cases where this could do the wrong thing (e.g. kinsol might have passed in a TaylorVar for polynomial analysis, and this would throw the warning, but then just replace it and continue)