LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read part of an array element

Solved!
Go to solution

Hello All.

 

As indicated in the title, I am trying to read part of an array element.

 

What I'm doing is reading values from a LeCroy scope using a "write" than "read" I have returned the read values into an array but the issue is the scope returns a value "1, 52.33E-3"

I simply want the element to be 52.33 that way I can use that for other calculations.

 

For example my array is.

 

"1, 34.334E-3"

"1, 53.343E-3"

"1, 143.232E-"

 

And I want it to be

 

34.334

53.343

143.232

 

Thanks!

0 Kudos
Message 1 of 5
(2,413 Views)
Solution
Accepted by topic author mdali

Use the string functions (Match Pattern) to find the comma. Then convert the part after the comma to a number using the appropriate String to Number function.

 

Are you throwing away what looks like an exponent intentionally?

 

The last string appears to be missing the exponent. This hints that you may have problems with your communications with the instrument.

 

Lynn

Message 2 of 5
(2,407 Views)

Another option is to use Spreadsheet String to Array and use the comma as the delimiter.  It can actually change your string into an array of numbers.  Then you just index out the number you want.


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
Message 3 of 5
(2,366 Views)

@crossrulz wrote:

Another option is to use Spreadsheet String to Array and use the comma as the delimiter.


Not if he wants to throw away the exponent part. That would get parsed into the number with your suggestion.

Message 4 of 5
(2,342 Views)

Thanks I used the Match Pattern string function using "1," as the regular expression, then used the "Fract/Exp String to Number".

 

As for the exponent I left it in there. The reason I left the "-3" in my question is because once the value exceeds 1 second the instrument returns the read with the last character missing. "1, 1104.323E". But this should not be an issue.

0 Kudos
Message 5 of 5
(2,328 Views)