Toggle Button to show whether an item is selected. If a Toggle Button is bound to a data source, the Toggle Button shows the current value of that data source as either Yes / No, True / False, On / Off, or some other choice of two settings. If the user selects the Toggle Button, the current setting is Yes, True, or On; if the user does not select the Toggle Button, the setting is No, False, or Off. If the Toggle Button is bound to a data source, changing the setting changes the value of that data source. A disabled Toggle Button shows a value, but is dimmed and does not allow changes from the user interface.
This video provides an example code of using Toggle button in Matlab applications