# stopButton

Displays a stop button.

## Contents

- Syntax
- Description
- Example
- Input Arguments
- Output Arguments
- See Also

## Syntax

[F, H] = stopButton()

## Description

[F, H] = stopButton() displays a Stop button that can be used, for example, to abort data collection using a PicoScope PC Oscilloscope in streaming mode.

## Example

    [F, H] = stopButton();

    flag = 1;
    setappdata(gcf, 'run', flag);

    disp('Entering loop.');

    n = 1;

    while(n == 1)

        flag = getappdata(gcf, 'run');
        drawnow;

        if(flag == 0)

            disp('STOP button clicked.')
            break;

        end

        % Perform some tasks

        % Check if 'STOP' button pressed
        flag = getappdata(gcf, 'run');
        drawnow;

        if(flag == 0)

            disp('STOP button clicked.')
            break;

        end

    end

    disp('Exited loop.');

    % Close the STOP button window
    if(exist('F', 'var') && exist('H', 'var'))

    close('Stop Button');
    clear F;
    clear H;

    end

    drawnow;

    Entering loop.
    STOP button clicked.
    Exited loop.

## Input Arguments

- None

## Output Arguments

- F - handle to the button's figure
- H - the uicontrol object

## See Also

`figure` | `uicontrol`

Copyright: © 2015 Pico Technology Ltd. All rights reserved.