LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extract values from element of array

Solved!
Go to solution

This may have already been brought up by someone and I haven't done enough searching, but attached is a shot of the array I have that. I need to get the digits from between the quotation marks. They need to stay in an array form to be used elsewhere, but I seem to be having trouble getting something to work. If someone can point me in the right direction or show me discussions that I may have missed, it would be appreciated.

 

0 Kudos
Message 1 of 6
(2,193 Views)

I would probably use Match Regular Expression or Search/Split String inside of a FOR loop to find your values.


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
0 Kudos
Message 2 of 6
(2,176 Views)

if you know the data you expect, and want to extract just the values, I like Scan from String.  For example, you have "hexData" line where you might want to extract the "N" of the hexData identifier (e.g. hexData3, identifier = 3) and the "hex Data" is really an I32.  This will do that -- N will get the value "23", while Value gets 2212892, the decimal represented by the hex string.

Scan from String.png

Bob Schor

0 Kudos
Message 3 of 6
(2,160 Views)
Solution
Accepted by topic author Jessica_2067

As crossrulz and Bob describe, there's many ways of doing it. Another way, less robust, would be to use the "match pattern" function and retrieve what's between the quotations (assuming your array elements will never see more than two quotation marks). And then using a conditional output tunnel on your for loop to filter out the empty string elements in your array that don't fit the desired pattern (see attached).

 

Certified LabVIEW Developer

0 Kudos
Message 4 of 6
(2,142 Views)

@crossrulz, I did try all those and it didn't seem to work out for me, even with conditional statements. I am not sure what I wasn't doing that nothing was working for me, but I now have a solution and can work on the next step.

@SergeB - your way did work thank you.

 

Thank you everyone for your suggestions.

0 Kudos
Message 5 of 6
(2,125 Views)

You very welcome. Glad we could help Smiley Happy

Certified LabVIEW Developer

0 Kudos
Message 6 of 6
(2,103 Views)