Main Content

button

Read status of joystick

Since R2025a

    Description

    b = button(joystick,n) reads the status of joystick button number n.

    Input Arguments

    collapse all

    Joystick object that interfaces a joystick device with the 3D environment, specified as a sim3d.io.Joystick object.

    Example: joystick = sim3d.io.Joystick(ID=1)

    Button number of joystick, specified as a real positive scalar or a real positive vector.

    Example: n = 1

    Example: n = [2 3]

    Output Arguments

    collapse all

    Status of joystick button, returned as either 0 or 1. If n is a vector, multiple buttons are returned.

    Version History

    Introduced in R2025a