取消
显示结果 
搜索替代 
您的意思是: 

hex string to hex array

已解决!
转到解答

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.

下载全部
0 项奖励
1 条消息(共 7 条)
9,628 次查看

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



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
2 条消息(共 7 条)
9,621 次查看
解答
已被主题作者 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.

 

3 条消息(共 7 条)
9,603 次查看

THANK YOU!

0 项奖励
4 条消息(共 7 条)
9,598 次查看

@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 项奖励
5 条消息(共 7 条)
9,588 次查看

Hello,

 

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

hex

0 项奖励
6 条消息(共 7 条)
9,584 次查看

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 项奖励
7 条消息(共 7 条)
9,559 次查看