06-08-2011 09:08 AM
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
Solved! Go to Solution.
06-08-2011 09:34 AM - edited 06-08-2011 09:34 AM
Just use the Spreadsheet String to Array function:
06-09-2011 02:24 AM
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
06-09-2011 02:46 AM
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
06-09-2011 02:52 AM
Use %e instead of %f for scientific notation, or %g for automatic.
/Y
06-09-2011 03:26 AM
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
06-09-2011 03:52 AM
Also the E symbol is signed which may confuse matters?
Regards
B
06-09-2011 04:11 AM
06-09-2011 04:26 AM
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
06-09-2011 04:30 AM - edited 06-09-2011 04:30 AM
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!