Select and find data from an AO

LTPDA contains a set of methods that can be used for the selection of data from an AO. In this section we will in particular look at ao/find and ao/select.

We will start by generating a sine wave:

    pl = plist('waveform', 'sine wave', 'f', 1, 'fs', 100, 'nsecs', 10, 'yunits', 'V');
    a  = ao(pl)

Example 1 - using find

Now let us use the find method to extract parts of the data we are interested in.

The find method can take a parameters 'query' for defining which data points you want to find. The query string can be any valid MATLAB logical expression, and in particular can be expressed in terms of the x and y data of the input AO.

In this example, we want to find all x values between 3 and 6. The following code does just that:

    a_find = find(a, plist('query', 'x>3 & x<6'));
    iplot(a, a_find)

Example 2 - using select

The select method lets us select a set of data samples from our AO. For this we need to specify a parameter via a plist containing an array of samples we want to select. We take our sine wave again which is stored in the variable a to see how it works.

    a_select = select(a, plist('samples', 200:800));
    iplot(a, a_select)

©LTP Team