01-31-2024 04:40 PM
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?
01-31-2024 06:26 PM
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.
02-01-2024 03:37 AM
02-01-2024 09:47 AM - edited 02-01-2024 09:47 AM
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.
02-01-2024 10:35 AM - edited 02-01-2024 10:37 AM
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.