Main Content


Read status of joystick button, axes and pov


[a,b,p] = read(joy)
[a,b,p] = read(joy,f)


[a,b,p] = read(joy) reads the status of axes, buttons, and point of views (POVs) of the specified joystick.

[a,b,p] = read(joy,f) additionally applies feedback forces to a force-feedback joystick.

Input Arguments

expand all

Joystick, specified as a vrjoystick object.

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

Force feedback to be applied to joystick axis, specified as a scalar or a vector in the range [-1,1]. f values should be in range of -1 to 1, and the number of elements in f should either match the number of elements of n, or f can be a scalar to be applied to all the axes specified by n.

Output Arguments

expand all

Status of joystick axis, returned as a real positive scalar in the range [-1,1]. If n is a vector, multiple buttons are returned.

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

Point of view, returned as a real scalar in degrees. When a value of -1 is no axis is selected.

See Also

Introduced in R2007b