Array node

Array Slice

Extract a contiguous subarray by start index and length. Useful for windowing, pagination, or extracting specific sections from a data buffer.

Inputs

PortTypeDefault
ArrayThe list to cut a piece out of. Cable any array here; an empty one gives an empty result.any—
StartWhere the cut begins. Negative counts back from the end, and anything past the end is pulled to the last element.int0
LengthHow many elements to take. Negative values are treated as 0, and asking past the end simply stops there instead of wrapping.int10

Outputs

PortType
Resultany
Countint

How It Works

Array Slice extracts a contiguous section of the array starting at Start (zero-based) and taking up to Length elements. If Start is negative, it wraps from the end. If the requested range extends beyond the array bounds, only the available elements are returned.

Use Cases

  • Windowing: Extract a fixed-size window from a rolling data buffer for FFT or visualization.
  • Pagination: Display a page of results by setting Start = page × pageSize and Length = pageSize.
  • Channel extraction: If channels are stored sequentially in a flat array, slice out a specific channel's data range.
  • Head/tail: Start=0 with a small Length gets the first N elements; a negative Start gets the last N.

Tips

  • Negative Start wraps from the end: Start=-5, Length=5 gives the last 5 elements.
  • If Length exceeds the remaining elements from Start, the result will be shorter than requested.
  • For extracting non-contiguous elements (e.g., every 3rd), use Array Sample instead.

Open Array Slice in the interactive catalog →

Array Slice is one of 381 nodes in Grafit Pro.

Free download. Every feature for 7 days, no card. Then €99.99 once — or keep playing your projects as a Player.

More Array nodes