When gapFind uses solveCobraMILP it fails because solveCobraMILP code for "gurobi5" solver doesnt create the x and f variable if no solution is found. This causes the code to fail at the end when it checks if x is empty because x has never been created.
At the beginning of the "gurobi5" specific section of solveCobraMILP it creates a resultgurobi structure with empty x and objval, but this is overwritten a bit later when the gurobi function is run. Also even if it wasnt overwritten, the x and objval is only transferred to x and f if gurobi returns success.
If you alter the code to return an empty x and f, then it fails on returning to gapfill...
Highly similar to the problem described here https://groups.google.com/forum/#!searchin/cobra-toolbox/gurobi/cobra-toolbox/ZxAVYQorrqQ/GjKFYSgLJ4MJ
When gapFind uses solveCobraMILP it fails because solveCobraMILP code for "gurobi5" solver doesnt create the x and f variable if no solution is found. This causes the code to fail at the end when it checks if x is empty because x has never been created. At the beginning of the "gurobi5" specific section of solveCobraMILP it creates a resultgurobi structure with empty x and objval, but this is overwritten a bit later when the gurobi function is run. Also even if it wasnt overwritten, the x and objval is only transferred to x and f if gurobi returns success. If you alter the code to return an empty x and f, then it fails on returning to gapfill...