Austin Schuh | 9049e20 | 2022-02-20 17:34:16 -0800 | [diff] [blame^] | 1 | Matlab |
| 2 | ====== |
| 3 | OSQP Matlab interface requires Matlab 2015b or newer. |
| 4 | |
| 5 | |
| 6 | Binaries |
| 7 | -------- |
| 8 | |
| 9 | Precompiled platform-dependent Matlab binaries are available on `GitHub <https://github.com/osqp/osqp-matlab/releases>`_. |
| 10 | |
| 11 | To install the interface, just run the following commands: |
| 12 | |
| 13 | .. code:: matlab |
| 14 | |
| 15 | websave('install_osqp.m','https://raw.githubusercontent.com/osqp/osqp-matlab/master/package/install_osqp.m'); |
| 16 | install_osqp |
| 17 | |
| 18 | |
| 19 | Sources |
| 20 | ------- |
| 21 | |
| 22 | You need to install the following (see :ref:`build_from_sources` for more details): |
| 23 | |
| 24 | - A supported 64bit `C/C++ compiler <https://www.mathworks.com/support/compilers.html>`_ |
| 25 | - `CMake <https://cmake.org/>`_ |
| 26 | |
| 27 | |
| 28 | |
| 29 | After you install both, check that your compiler is selected by executing |
| 30 | |
| 31 | .. code:: matlab |
| 32 | |
| 33 | mex -setup |
| 34 | |
| 35 | .. note:: |
| 36 | |
| 37 | **Windows**: If Matlab does not find TDM-GCC, you need to set the environment variable :code:`MW_MINGW64_LOC` as follows |
| 38 | |
| 39 | .. code:: matlab |
| 40 | |
| 41 | setenv('MW_MINGW64_LOC', 'C:\TDM-GCC-64') |
| 42 | |
| 43 | |
| 44 | where :code:`C:\TDM-GCC-64` is the installation folder for TDM-GCC. |
| 45 | |
| 46 | You can now build the interface by running inside Matlab |
| 47 | |
| 48 | .. code:: matlab |
| 49 | |
| 50 | !git clone --recurse-submodules https://github.com/osqp/osqp-matlab |
| 51 | cd osqp-matlab |
| 52 | make_osqp |
| 53 | |
| 54 | |
| 55 | Then you can add the interface to the search path by executing from the same directory |
| 56 | |
| 57 | .. code:: matlab |
| 58 | |
| 59 | addpath(pwd) |
| 60 | savepath |