LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

scan from string

Solved!
Go to solution

Hi

 

I am trying to sort out incoming string data which is in the form

 

+6.40E+003

 

each number (which is still in string form) is seperated by a comma ( ,) to give +6.40E+003,-7.60E+003    and so on

 

I using scan from string and am currently tearing my hair out , as I cannot extract the number. (being a noob)

 

All I am using for a fomat is on the 'scan from string' is %10f, in order to try and get the above numbers out .

 

Please help

 

B

0 Kudos
Message 1 of 12
(3,710 Views)

Just use the Spreadsheet String to Array function:

 

0 Kudos
Message 2 of 12
(3,702 Views)

Hi

 

Thanks for the reply ....attached is a picture of my arrangement and a sample of the resulting txt. file. It appears that the end of the 'number' is being chopped off at the end and the scientific notation is being ignored. For instance the last number in the txt file reads

 

1,000000 but should be 1e5 ...i guess 1,00000e.t.c. is 1e5 if you ignore the comma .

 

How would I correct this ?

 

Regards

 

B

Download All
0 Kudos
Message 3 of 12
(3,674 Views)

Hi

 

I have added the format %.;%.3f , which has helped .....Although every 4th line appear to be chopped . The data should increase from 0-> 102400 approx....(attached txt file)

 

Why is it chopping some data off every now and again ?

 

Regards

 

B

0 Kudos
Message 4 of 12
(3,662 Views)

Use %e instead of %f for scientific notation, or %g for automatic.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 12
(3,656 Views)

Dear Yamaeda

 

Doesn't make a difference whether if have %e or %g after the %.;.....please refer to the attached txt file and below sample of txt.

 

256,000
512,000
7,680   ........should be 768 I reckon
2,000 ...........some number in between has been chopped off
1020,000
1280,000
1540,000
1,000.......................maybe this should read 1790
79000,000................
2050,000
2300,000
2,560................this should be 2560
0,000
2820,000
3070,000
3330,000
3,580
3,000
3840,000
4100,000
4350,000

 

This should increment as it is just x-data ...in some cases it follows the format in other cases it just ignores it ..throughout? Maybe I should convert this text string to somethin before applying the fomatting ???? As each 'number' is signed which may be throwing things ?

 

Regards

B

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

Also the E symbol is signed which may confuse matters?

 

Regards

 

B

0 Kudos
Message 7 of 12
(3,649 Views)

Hi barrys,

 

no, the sign on the E part shouldn't confuse the conversion routine.

 

Please attach the original data (or atleast a small part of it), so we could check that input file for any problematic parts...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 12
(3,640 Views)

Hi

 

The input comes from here (see attached pic).....The string (or buffer as it is called here ) is in the form of a C-string pointer on the "recieve VI' (attached pic).

 

I have configured the instrument to send ascii with 4 significant digits.

 

The string being received from the VI appears non-problematic it has the 4 sig. digits and E.....such as +1.570E+003,+1.223E+003,.....e.t.c..(as per string indicator)....however when you try and handle it all these problems start appearing.

 

The best data output I am getting at the moment is in the attached txt file. As you can see things go well fo a little bit and then go wrong ...There appears some pattern here though.

 

The instrument sendin the data is an ol HP 35665A , but like I said the string that it is sending appear unproblematic as it has the correct form .

 

Regards

B

Download All
0 Kudos
Message 9 of 12
(3,636 Views)

Hi barrys,

 

"The string being received from the VI appears non-problematic"

Yes, it appears unproblematic - but is it? There might be spurious transmission errors, non-printable chars, etc.

 

Please collect the received string data and write those input strings to a file. Then attach the file... The examples you gave before can be converted in the way also presented before!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 12
(3,632 Views)