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

string to array

0 Kudos
Message 1 of 20
(6,066 Views)

string to array

0 Kudos
Message 2 of 20
(6,057 Views)
Solution
Accepted by topic author nouman.ashraf91@yahoo.com

Hi nouman,

 

what have you tried so far?

 

Did you use StringSubset? In a loop to get parts of your input string? That would be the most forward approach…

 

Here's a different approach:

check.png

 

P.S.: no need to post twice when you can edit your own message!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 20
(6,056 Views)

yeah i tried string subset in a loop but i didnt got my desired results.

the thing i am trying is that the first two characters of string to be placed at index 0 of array the next two on index 1 and so on.

0 Kudos
Message 4 of 20
(6,044 Views)
Solution
Accepted by topic author nouman.ashraf91@yahoo.com

Here's another take on the solution.

 

Parse String.png

 

Here are the results that it provides:

 

String parse FP.PNG

 

Is this what you are going for?

Wes Pierce
Principal Engineer
Pierce Controls
0 Kudos
Message 5 of 20
(6,037 Views)

thanx both of them works for me one converts in a row second one in a column

0 Kudos
Message 6 of 20
(6,024 Views)

They actually give the exact same result.  I don't know what you mean by a row vs. a column.  They both give 1-D arrays.  Whether it looks like a row or a column is just a function of how you drag out the array indicator to show multiple elements.

0 Kudos
Message 7 of 20
(6,012 Views)

string 1,2,3,4 are of 32 bits each and i want them to convert them into a 4*4 matrix but i am only getting the first row not a 4*4 matrix at the end. what am i doing wrong.?

0 Kudos
Message 8 of 20
(5,998 Views)

Attach your code as a VI with your data saved as default in the strings.

 

It seems wierd that you are doing a conversion from binary to hex.

 

If you want a 4x4 array, then reshape array should use 4 as a constant rather than a 2.

0 Kudos
Message 9 of 20
(5,995 Views)

i want two characters at 1*1 position of matrix so first reshape array is used to make a array having two characters at every index. i am getting an array having 2 characters at every index after for loop then i want to convert it into a 4*4 matrix but i am getting only first row.

0 Kudos
Message 10 of 20
(5,981 Views)