LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read large number from text file

hi
 
i have a problem with my data reading from a text file, the data saved in the text file are very large number, like (460000000000), however, i got a problem when i read datd from that file, system only can read the first 2 or 3 digits for each number except 1st and last number, the rest digits always give 0000000000. how can i do it?
 
thanks
0 Kudos
Message 1 of 9
(3,098 Views)
Hello nkf,

how do you convert your numbers? Do you convert them at all or do you just treat them as strings?
Can you give an example of your text loader?

Btw. normal string conversion ('Scan from string') also takes big numbers, I just tested '456000000000000' and it gave 4.56E14 back...

Message Edited by GerdW on 05-17-2006 09:14 AM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(3,092 Views)
Hi
i post my test.vi to let you check for me.
Download All
0 Kudos
Message 3 of 9
(3,088 Views)

Hi,

i need to find  out the difference between that numbers and my reference,

actually, the difference between them are very small, so i need to know the last 2 or 3 digits exactly,

but every time i load the data from file, system always ignore the last 2 digits and let them be 0s.

thanks

0 Kudos
Message 4 of 9
(3,087 Views)
Hello nkf,

can you give some examples of your numbers?

My guess: Your numbers exceed the limits of floating point representation (SGL: ~7 decimal digits, DBL: ~12 digits, EXT: ~17 digits).
No guess, but knowledge after seeing your vis: You use 'Read from spreadsheet'. This gives back only SGL numbers with only 7 digits accuracy. Better use a combination of 'Read text' and 'Scan from string'. Make a DBL or EXT constant wired to the default input of 'Scan from string'. Now your numbers should be read in correctly!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 9
(3,086 Views)
hi
 
how can i do that, i am using Lv6.1, i can not find "Read text" function, so can you post a sample for me. thanks
 
 
0 Kudos
Message 6 of 9
(3,079 Views)
Hello nkf,

I meant 'Read characters from file' or 'Read lines from file'. You can use both, the idea is to read in the text and do the parsing on your own. 'Read from spreadsheet' does both tasks in one step, but is limited in accuracy...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 9
(3,072 Views)
Hello GerdW
i tried your method, now i can load data from file to character string correctly, but after scan from string function, the result still the same as i got before. i have set the format string to %f.
 
Thanks
 
regards
0 Kudos
Message 8 of 9
(3,057 Views)
Hello nkf,

well, for me 'Scan from String' works perfectly... (up to the limit of EXT representation).

Maybe you forgot to set the default for the desired output to DBL or EXT? What type of output do you have at the 'Scan from string'?

Message Edited by GerdW on 05-17-2006 01:29 PM

Best regards,
GerdW


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