Main Content


Display button widget on device screen

  • Button block

Simulink Support Package for Android Devices / User Interface


The Button block displays a button widget on the Android® app. The button has two states: pressed and not-pressed. Tapping the button switches the state of the button. The Button state parameter determines the button state when the Android app starts.


During simulation with no hardware connected, this block does nothing. For more information, see Block Produces Zeros or Does Nothing in Simulation.



expand all

The block outputs the button state, returned as a Boolean scalar. If the button state is Pressed, the block outputs 1. If the button state is Not Pressed, the block outputs 0.

Data Types: Boolean


expand all

Select the initial state of the button when the Android app starts.

Specify a discrete time interval, in seconds, at which the block reads the button state and outputs the data.


Smaller values for Sample time require the processor to complete the same number of instructions in less time, which can cause task overruns.

Version History

Introduced in R2015a