- Last Updated on Monday, 01 August 2011 17:22
Update August 1st 2011: added support for POV Hats.
joymex2 is a MATLAB MEX-file which provides access to gamepad devices in MATLAB through SDL. The MEX-file can be used as is, for simply querying axes and buttons status of all connected gamepad devices but it can also be used as a starting point to implement more advanced features like force feedback. (I might even add some simple force feedback support in the coming weeks myself.)
- MATLAB R2006a or higher
- libsdl (binaries included in download)
- Supported MEX Microsoft Visual C++ compiler
- Microsoft Visual C++ 2005 SP1 redistributable (for your platform, i.e. x64 for 64-bit MATLAB or x86 for 32-bit MATLAB)
Open Joystick with ID 0:
Opened Joystick 0 Name: Microsoft X-Box 360 pad Number of Axes: 6 Number of Buttons: 11
Number of Hats: 1
Query data from Joystick with ID 0:
>> data = joymex2('query',0)
data = axes: [0 0 0 0 0 0] buttons: [0 0 0 0 0 0 0 0 0 0 0 hats: [1x1 struct]
ans = up: 0 right: 0 down: 0 left: 0
Close Joystick with ID 0:
Also see the example joytest.m which is included in the downloads.
If all prerequisites above are met (and mex has been configured through mex -setup), the MEX-file can be build by running build.m which is inlcuded in the downloads.
If you run into any difficulties or need any help in using the MEX-file please e-mail to: devel[at]escabe.org