Catching NetSolve errors

There are two NetSolve functions that can be called from Matlab to catch errors. The first function, netsolve_err() takes no arguments and returns an integer that is the NetSolve error code returned by the last call to a NetSolve function (see Chapter 24 for a list of the possible error codes). Here is a call:
>> e = netsolve_err
e = -11

The other function, netsolve_errmsg() takes an error code as an argument and returns a string that contains the corresponding error message. A typical call to netsolve_errmsg() is as follows:
>> [msg] = netsolve_errmsg(netsolve_err)

msg =

 bad problem input/output
With these two functions, it is possible to write Matlab scripts that call NetSolve and handle all of the NetSolve errors at runtime.