Main Content


(To be removed) Read status of joystick

button will be removed in a future release. For more information, see Version History.


b = button(joy,n)


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

Input Arguments

expand all

Joystick, specified as a vrjoystick object.

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

Output Arguments

expand all

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

Version History

Introduced in R2007b

collapse all

R2023b: To be removed

The button will be removed in a future release. Instead, use sim3d classes and Simulation 3D blocks to interface MATLAB® and Simulink® with the Unreal Engine® 3D simulation environment. To get started, see Create 3D Simulations in Unreal Engine Environment.

See Also