Running the example

Running the example

The Gurobi MATLAB examples can be found in the <installdir>/examples/matlab/ directory of your Gurobi installation (the default <installdir> for Gurobi 6.5.0 is /opt/gurobi650/linux64 for Linux, c:\gurobi650\win64 for 64-bit Windows, and /Library/gurobi650/mac64 for Mac). To run one of the examples, first change to this directory in MATLAB, then type its name into the MATLAB prompt. For example, to run example mip1, you would say:

>> cd /opt/gurobi650/linux64/examples/matlab
>> mip1

If Gurobi was successfully set up for use in MATLAB, you should see the following output:

         status: 'OPTIMAL'
    versioninfo: [1x1 struct]
         objval: 3
        runtime: 0.0386
              x: [3x1 double]
          slack: [2x1 double]
       objbound: 3
      itercount: 0
   baritercount: 0
      nodecount: 0

x 1
y 0
z 1
Obj: 3.000000e+00

The MATLAB example directory contains a number of examples. We encourage you to browse and modify them in order to become more familiar with the Gurobi MATLAB interface.