From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

i want to split a string after every two characters into a string can somebody help me.?

Solved!
Go to solution

You need to put your data into the strings and save the values as default.  Then save the VI and upload it.

0 Kudos
Message 11 of 20
(1,825 Views)

Maybe  you could tell us what it is exactly that you are trying to do. It looks like you are trying to do some byte manipulation on data coming in. There might be an easier, more direct way to go about it.

Wes Pierce
Principal Engineer
Pierce Controls
0 Kudos
Message 12 of 20
(1,822 Views)

i am trying to achieve something like this.

but the input must be in binary. so i converted it into hex and concatenated all strings.

0 Kudos
Message 13 of 20
(1,810 Views)

Attach the VI with your data saved in it.

 

Why does this screenshot show only 1 string, but your VI has 4 string controls?

0 Kudos
Message 14 of 20
(1,789 Views)

So just to clarify, you have string data as an input that has binary data, correct? So this is an ASCII representation, something like "1001100110100011" etc.? And you want to display that as individual bytes, represented in Hex?

 

You could simply break the string up into byte-sized elements (8-chars), convert to a binary integer, like you did, and then just display the interger as Hex. You can right click a numeric indicator, and select Visible Items»Radix. Then you can select "x" to view the number in Hex form. That might be a simpler approach.

Wes Pierce
Principal Engineer
Pierce Controls
0 Kudos
Message 15 of 20
(1,784 Views)

i have 4 strings as input with data in binary and i want an output like in the 4*4 matrix of screenshot.

to do this first i concatenated all those strings then converted in hex then make an array having 2 characters at every index and then convert it into a matrix.

but i am only getting first row of matrix

0 Kudos
Message 16 of 20
(1,780 Views)

Now that we have data, we can see what is wrong and can fix it.

 

The problem is you are taking your superlong string of 1's and 0's and converting it to a single U32 numeric, thus throwing away all the remaining data.

 

Convert the numbers into groups of 8 characters, and go through them in a loop to convert to U8 bytes.  The regroup from there and convert to a Hex string that represents that data.

 

Download All
0 Kudos
Message 17 of 20
(1,765 Views)

@RavensFan wrote:

Convert the numbers into groups of 8 characters, and go through them in a loop to convert to U8 bytes.  The regroup from there and convert to a Hex string that represents that data.


You are incrementing the subset by 1, so you get overlapping segments. I don't think this is correct.

0 Kudos
Message 18 of 20
(1,744 Views)

Here's what I would do. Modify as needed.

 

Download All
0 Kudos
Message 19 of 20
(1,732 Views)

@altenbach wrote:

@RavensFan wrote:

Convert the numbers into groups of 8 characters, and go through them in a loop to convert to U8 bytes.  The regroup from there and convert to a Hex string that represents that data.


You are incrementing the subset by 1, so you get overlapping segments. I don't think this is correct.


Dohh!.  You're right.  I missed i*8 going into the subset.

0 Kudos
Message 20 of 20
(1,724 Views)