LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

hex string to hex array

Solved!
Go to solution

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.

Download All
0 Kudos
Message 1 of 7
(6,868 Views)

Change your U16 Array constant into a 2D array and get rid of the FOR loop.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 7
(6,861 Views)
Solution
Accepted by topic author hiNI

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.

 

Download All
Message 3 of 7
(6,843 Views)

THANK YOU!

0 Kudos
Message 4 of 7
(6,838 Views)

@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?

0 Kudos
Message 5 of 7
(6,828 Views)

Hello,

 

I was able to get the desired output after implementing your code and using the code added below:

hex

0 Kudos
Message 6 of 7
(6,824 Views)

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.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 7 of 7
(6,799 Views)