Phidgets Stepper Motor controller install for Matlab

Related: Phidgets Python install

Note: Phidgets v2.2 appears to have dropped Matlab support, this page is for obsolete Phidgets v2.1.

Suggest upgrading to using Python instead of Matlab for Phidgets.

0. Prereqs

Matlab R2015b or newer (R2017a or newer is preferred). Older versions of Matlab (R2015a and older) are NOT recommended because there are conflicts using old Windows SDK and Visual Studio with current Windows version.

1. Configure C/C++ compiler

The procedure for installing a C/C++ compiler is distinct for Linux, Mac and Windows. Using C/C++ shared libraries (.dll, .so) directly from Matlab via loadlibrary()` in general requires an external C/C++ compiler to be installed.

1a. Linux

sudo apt intall gcc g++

1b. Mac

brew install gcc

1c. Windows

  • On Matlab R2017a and newer, you install MinGW C/C++ compiler via the Matlab Add-On Explorer (in Matlab, click Home > Environments > Addon).

  • On Matlab R2015b-R2016b, you need to manually install the MinGW compiler by downloading and extracting the 5 zip files noted by “Mathworks Support Team” answer.

Matlab finds the MinGW C/C++ compiler via the Windows environment variable MW_MINGW64_LOC. If you’re having trouble with Windows not finding the MinGW compiler, find where it’s installed (here we’ll assume it’s in c:\gcc) and issue the command in your main program


2. Connect Matlab to compiler

This is done one time, from Matlab:

mex -setup c
mex -setup c++

3. Load Phidgets library

Download and install the Phidgets drivers for your operating system.

NOTE: Phidgets 2.1 was the last version to support Matlab. Phidgets 2.2 apparently dropped Matlab support. Consider Python for Phidgets.

They include an example stepper.m that should just work with your connected Phidgets motor.