LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parsing string into channels input

Solved!
Go to solution

Hello

 

I am attempting to parse a String into a matrix or arrays in real time. So, assuming the line below is part of my input

 

A134B932C321D95E532F1024A13B932C321D95E532F1024

 

I would like to parse the data and continously create a matrix (or series of arrays) such that each row corresponds to a letter. For example something like below:

 

13 13

932 932

321 321

95 95

532 532

1024 1024

 

I have been able to parse the string using the letters as delimiters but I have not been able to find a way to organize the values. The overall goal of my project is to be recieving 6 different input from a mircoprocessor and displaying the inputs on different graphs.

 

Thank you in advance,

0 Kudos
Message 1 of 22
(2,750 Views)

If you show what you have done so far, then it is much easier for someone to be able to help you the rest of the way.

0 Kudos
Message 2 of 22
(2,738 Views)

In LabVIEW a matrix is a special type of array and is used only for certain mathematical operations which are defined on matrices.  You want standard LV arrays.

 

Your string starts A134... but you parse it as 13.  A typographical error?

 

Please post what you have tried with a typical input string saved as default.  It is much easier for us to see what you have accomplished and help you toward a solution.

 

Lynn

0 Kudos
Message 3 of 22
(2,737 Views)

Is the channel count fixed?

 

TailOfGon
Certified LabVIEW Architect 2013
0 Kudos
Message 4 of 22
(2,726 Views)

Hello

 

The A134 and parse 13 was a typographical error.

 

I have attached a image of my block diagram in labivew. Currently I am able to slipt based on the letter but unable to group all of the same letter together. The amount of channels will be constant (in this case 6 inputs). 

0 Kudos
Message 5 of 22
(2,722 Views)

Set your default data type for the conversion to array to be a 1-D array.  Then on every iteration of the while loop, build that 1-D array into a 2-D array that you store in a shift register.

0 Kudos
Message 6 of 22
(2,718 Views)

You can use a regex. There will be an extra blank element you have to handle if you do it this way,either with a case structure or trimming the array..

 

 

0 Kudos
Message 7 of 22
(2,706 Views)

Ooops, I forgot to show what Raven's suggested, using build array to make the 2D array. But, building an array with a shift register is fairly basic.

0 Kudos
Message 8 of 22
(2,685 Views)

I agree with Greg, regex is the best way to handle such a string manipulation. I like my regex to be very specific. (I heard that the more specific, the faster it executes) Here is another way. This ensures that which index belongs to which channel.

TailOfGon
Certified LabVIEW Architect 2013
0 Kudos
Message 9 of 22
(2,682 Views)

Hey

 

I created the recommended shift register and my block diagram can be seen below. However, my input in the array is getting shifted. The inputs are variable values, and as a result I need the parsing to "detect" which letter it is and add value in the correct row or column. I am unsure what change I need to make in order to determine which row each value should go into. 

 

Thanks for all your help so far. 🙂 

0 Kudos
Message 10 of 22
(2,675 Views)