beta
cables is under heavy development.
There might be one or another bug, please let us know about it!

ArrayChunk Op

Ops.Array.ArrayChunk


ArrayChunk
Namespace: Ops.Array

Op author: tim

Extracts x elements from an array


Creates a new array with Chunk Size elements starting from Start Index, copies the values from the input array (shallow copy).
If there are less elements in the array than Chunk Size, the size of the output array may be smaller.

*Example 1: *

  • Input Array: 1, 2, 3, 4, 5
  • Start Index: 2
  • Chunk Size: 3
  • Output Array: 3, 4, 5

*Example 2: *

  • Input Array: 1, 2, 3, 4, 5
  • Start Index: 3
  • Chunk Size: 3
  • Output Array: 4, 5

ArrayChunk has a special mode – Circular – when set to true, elements from the beginning of the array will be included:

Example 3:

  • Input Array: 1, 2, 3
  • Start Index: 1
  • Chunk Size: 3
  • Circular: true
  • Output Array: 2, 3, 1


Inputs

Input Array (Array)

The array to get a chunk out of

Begin Index (integer /Number)

The index where the chunk should begin

Chunk Size (integer /Number)

How big the chunk should be, if there are not enough elements at the end of the Input Array the chunk will be smaller

Circular (boolean /Number)

If true, values from the beginning will be taken when end reached

Outputs

Output Array (Array)

Included Chunk Size elements or less

Array length (Number)
Caught a mistake or want to contribute to the documentation?

Edit Documentation 

ArrayChunk example

Open Example In Editor

Patches using ArrayChunk