Copy array COPY

Copies Count elements from one array line to another.

Source slice, through Read Count elements first, to Write to destination slice in the project.Source sliceRead Count elements firstWrite to destination slice

How it works

While the rung is true, copies Count elements from the Source array, starting at Source start, into the Destination array, starting at Dest start. Both arrays hold the same type. Every Source element is read before any is written, so copying within one array works even when the ranges overlap. A Count of 0 copies nothing. A negative Count, or a range past the end of either array, is a fault and writes nothing at all.

Operands

OperandData typeRead or write
SourceArray of BOOL, DINT, REALReads
Source startDINT or a numberReads
DestArray of BOOL, DINT, REALWrites
Dest startDINT or a numberReads
CountDINT or a numberReads

Common mistakes

  • Expecting the part that fits to be copiedIf any of the range is past the end of either array, nothing is copied. Check Start and Count against the array size.