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

ArrayChunk
op id:c7ee6c6e-ca88-4c24-b289-78bb922bf5f7
Extracts x elements from an array

summary (oneliner)

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

doc

issues

youtube id

collections

related ops

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


ArrayChunk example:


Credits

Caught a mistake or want to contribute to the documentation?


Edit this documentcancel save

Examples using ArrayChunk

Public Patches using ArrayChunk