This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Display button widget on device screen


Display a button widget on the device screen. The button has two states: pressed or not-pressed. Tapping the button switches its state.

The Button block outputs a boolean value. If the button state is Pressed, the block outputs 1. If the state is Not Pressed, the block outputs 0. The Button state parameter determines the button state when the app starts.

For simulations with no hardware connected, this block outputs the initial state.

Dialog Box

Button state

The initial state of the button when the app starts.

Sample time

The frequency with which the button state is read and output.

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

See Also

Introduced in R2015a