LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract exponential number from string

Solved!
Go to solution

Hi, I have an input string and I want to grab exponential value 0009.578e-01 from it. I could only get data up to the "e-". What am I doing wrong?

 

Thank you in advance!

 

0 Kudos
Message 1 of 6
(3,689 Views)

You don't have any separation between your numbers.  How do you know when one number ends and the next begins?

 

You really aren't extracting any exponential numbers, you are just doing some string manipulations.

 

But you do have more after that e-.  Your string indicator is just not wide enough to show it.

0 Kudos
Message 2 of 6
(3,680 Views)

There is no way to know if the number is:

0009.578e-01

0009.578e-013

0009.578e-0130

etc. You definitely need to know how many digits the exponent has. Once you cut at the right place (using string subset), fract/exp string to number will work just fine.

0 Kudos
Message 3 of 6
(3,677 Views)
Solution
Accepted by topic author LNH02

Sorry, I should mention that the data field is 12 bytes

0009.578e-01.

 

Anyhow, it did work--I had my String Subset substring length too large and the indicator box too small so the string was not properly shown.

 

Thank you for the prompt response!

0 Kudos
Message 4 of 6
(3,651 Views)

I think you should still look into your communication method so you get a distinctive delimiter between your numbers.  What happens if one of your numbers happens to have the same combination of digits as you are using in your search function?  Searching the string won't know if it found a tag or a value.

0 Kudos
Message 5 of 6
(3,631 Views)

Yes, I do agree with you. Thank you.

0 Kudos
Message 6 of 6
(3,625 Views)