Phidgets Stepper Motor controller install for Matlab

Related: Phidgets Python install


  • Phidgets v2.2 dropped Matlab support, this page is for obsolete Phidgets v2.1.
  • Matlab only supports a subset of Phidgets features.
  • Suggest upgrading to using Python instead of Matlab for Phidgets.

0. Prereqs

Matlab ≥ R2015b (≥ R2017a is preferred). Matlab ≤ R2015 is 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

apt install gcc g++

1b. Mac

brew install gcc

1c. Windows

  • On Matlab ≥ R2017a, 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

setenv('MW_MINGW64_LOC','c:\gcc')

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.

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

Notes

Leave a Comment