Setting up the Gurobi MATLAB interface

In order to use our MATLAB interface, you'll need to use the MATLAB function gurobi_setup to tell MATLAB where to find the Gurobi mex file. This file is stored in the <installdir>/matlab directory of your Gurobi installation. For example, if you installed the 64-bit Windows version of Gurobi 7.5 in the default location, you should run

>> cd c:/Users/jones/gurobi752/win64/matlab
>> gurobi_setup

The gurobi_setup function adjusts your MATLAB path to include the <installdir>/matlab directory. If you want to avoid typing this command every time you start MATLAB, follow the instructions issued by gurobi_setup to permanently adjust your path.

The MATLAB examples provided with the Gurobi distribution are included in the <installdir>/examples/matlab directory. To run these examples you need to change to this directory. For example, if you are running the 64-bit Windows version of Gurobi, you would say:

>> cd c:/Users/jones/gurobi752/win64/examples/matlab
>> mip1

If the Gurobi package was successfully installed, 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

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.

Search