mat_joy – MATLAB Interface for Joysticks

Admittedly, it already exists – http://code.google.com/p/prok-screen/ but its awkward way of doing things (exposing functions using ActiveX server) was a bit of overkill for our needs. Hence, this stripped down, pure MEX version. Enjoy.

Usage: [position, buttons] = mat_joy(joystick_id), where:

joystick_id – joystick identifier (0-15),
position – list of joystick position in X, Y and Z axis,
buttons – list of 16 joystick button states (missing buttons are always zeros)

DOWNLOAD: mat_joy.zip

5 Comments

  • Hi,

    I have a gamepad with 2 analog joysticks. Is it possible to adapt your mex function so that more joysticks can be read?

    Cheers
    Jan

  • As you can see the parameter list contains joystick ID, so you might be able to get data from your 2 joysticks by using ID 0 and 1 – have you tried that? The joyGetPos() WinAPI function that I use to get joystick position doesn’t support any other way of identifying joysticks.

    • I could get two buttons responses from Joystick. But I want to read 5 or 6 button responses for Joystick. How can I change the program for that. Does your C and MEX file support for any number of inputs?

      Thanks


Leave a Reply

Your email address will not be published. Required fields are marked *