# Stream

## class nominal.Stream

An open write path into a dataset.

Opened from a dataset:

```matlab
s = ds.stream();
```

The fastest path is a block of samples sharing one clock:

```matlab
chans = [s.channel("rpm"), s.channel("egt"), s.channel("psi")];
t = zeros(1000, 1, 'int64');
v = zeros(1000, 3);            % one column per channel
... fill in a loop ...
s.push(chans, t, v);
```

Preallocate the matrix, fill it, and push it whole.

Deleting the stream, or clearing its last variable, flushes what is
still buffered and blocks until that completes. Call delete(s) when
the data must be in Nominal before you move on.

push blocks when the stream saturates: if points arrive faster than
the network drains them, it waits instead of queueing without bound.

> **See also**
>
> [`nominal.Channel`](https://dev.nominal.io/matlab/ref/Channel.md#nominal.Channel "nominal.Channel"), [`nominal.Dataset`](https://dev.nominal.io/matlab/ref/Dataset.md#nominal.Dataset "nominal.Dataset")

Constructor Summary

Method Summary
:   ### channel(name)

    A write address for a named channel on this stream.

    Sends nothing to Nominal. The channel appears in Nominal when the
    first point arrives.

    Returns:
    :   *nominal.Channel* – The write address.

    ### push(channels, timestamps, values)

    Write an N-by-C block of samples across C channels.

    ```matlab
    s.push(chans, t, V)
    ```

    All channels share the timestamp column. For channels on
    independent clocks, push each separately with Channel.push.
    Blocks if the stream has saturated.

    Parameters:
    :   - **channels**

          1-by-C array of nominal.Channel.
        - **timestamps**

          N-by-1 int64 nanoseconds, or a datetime
          vector. Literal, including zero.
        - **values**

          N-by-C double, one column per channel.
