Assuming you have two arrays named array1
and array2
, you can copy the first element of array1
to the first 20 indexes of array2
using the following code:
main.m26 chars2 lines
To do this for the rest of the elements of array1
, you can use a for
loop:
main.m134 chars6 lines
This will loop through each element of array1
(starting from the second element), and copy it 20 times to the next 20 indexes of array2
.
Note that if the length of array1
is not evenly divisible by 20, the last few indexes of array2
may not be filled with a copied value.
gistlibby LogSnag