I have 1D array that in need to combine the elements in specific order.
Example:
Elements are arranged like this:
AA
BB
CC
DD
EE
FF
Then, I want it to arrange like this:
BBAA
DDCC
FFEE
How can i do this?
You need to be significantly more specific.
Are these array elements strings, integer in hex display, or something else. If the first array is U8 and the second U16, a simple decimate array (two outputs) followed by join numbers would do it. Make sure to consider byte order.
If these array elements are strings, you could concatenate the strings.
As I already said, here's one (of many!) other interpretation and two different solutions that do the same:
You really (really!!) need be be significantly more specific! You also need to define what do do with exceptions, for example if the input array has an odd number of elements, the above code versions would drop the extra element.
Hmmm, I suspect the OP is not being that specific because this is a schoolwork problem. 😉
EDIT: I could be wrong though. Just noticed he's been around since 2007.