Table of Contents

Marble diagram

The Slice operator specifies an index-based filter over elements of the source sequence. Elements from the source sequence are accepted if their index is: greater than or equal to Start; less than Stop, or the stop index property is not specified; not set to be skipped by the Step property.

Warning

If the index of elements in the source sequence becomes greater than or equal to Stop, then Slice will terminate successfully and cancel the subscription to the source sequence.

Examples

Use Slice to extract n-th elements from a sequence.

Slice Example

Deinterleave Video Frames

Use Slice to separate elements from an interleaved sequence (e.g. frames from a fiber photometry camera).

Slice Application DeinterleaveVideo

Note

This example requires the Bonsai.Vision and Bonsai.Vision.Design packages to be installed.

Use GateInterval to extract elements based on time.