09-17-2012 11:06 AM
Hello,
I have a hex string that contains the address then word:
0 8E39
1 60E3
2 1B
3 42
4 100
5 0
I am trying to generate two arrays, one with the address in two bytes and the other with the word in four bytes so that I will end up:
00 8E39
01 60E3
02 001B
03 0042
04 0100
05 0000
Any help will be greatly appreciated!
Thanks,
hiNi.
Solved! Go to Solution.
09-17-2012 11:13 AM - edited 09-17-2012 11:14 AM
Change your U16 Array constant into a 2D array and get rid of the FOR loop.
09-17-2012 11:30 AM - edited 09-17-2012 11:30 AM
You can also directly use "read from spreadsheet file" (but you need to convert to U16 later).
@hiNI wrote:
I am trying to generate two arrays, one with the address in two bytes and the other with the word in four bytes so that I will end up:
You said you wanted two arrays, so you still need to slice out the two columns.
09-17-2012 11:31 AM
THANK YOU!
09-17-2012 11:42 AM
@hiNI wrote:
I am trying to generate two arrays, one with the address in two bytes and the other with the word in four bytes so that I will end up:.
Well, both the address and the word are currently in two bytes each (U16). "four bytes" would only make sense if you format the number into a hexadecimally formatted string (the display format of numerics has nothing to do with the underlying number of bytes).
Can you explain what you really want?
09-17-2012 11:50 AM
Hello,
I was able to get the desired output after implementing your code and using the code added below:
09-17-2012 03:46 PM
Why keep them in separate arrays? Why not use a 2D array to contain them? It seems the data is related and when kept separate there is a better chance for things to get misaligned.