LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

data changed when write to spread sheet

I am using "write to spread sheet.vi" for writing a 2-D array to file.
I found that the data wrote in file is a little different from the data in array. 
For example,
114.97959, 115.00459, 115.02959  in array, but the data in file is
114.979591,115.004593,115.029587.
 
I checked the format&decision for array, and it is zeros from 6th digit.
 
What's wrong?
0 Kudos
Message 1 of 11
(3,840 Views)
Are you sure that the 6th digit is zero? 5 digits of presition in the control or indicator doesn't mean that the number will be rounded to this presition, the number will still been the same (a double presition number for example) but you will see in the control or indicator this value rounded to 5 digits of presition. See the example attached, the number 1.23456789 is displayed in a control with 3 digits of presition (1.234), after that I read a local variable of this indicator with 3 digits of presition and then display the value in a control with enough digits of presition I'll see the value 1.23456789 because the number doesn't change. I guess that you're looking the numbers in a 5 digits of presition indicator and then you believe that the 6th digit is zero, but It isn't, you're saving the data with 6 digits of presition so the 6th digit of the number appears in the saved data. If this is not what is happening then attach your VI to see the code. Bye.








Mensaje editado por Paul_m6
Paul
Mechatronic engineer
Lima-Perú
0 Kudos
Message 2 of 11
(3,813 Views)
Yes, I am sure. After 6th digit (including 6th digit), they are zeros.
0 Kudos
Message 3 of 11
(3,795 Views)
Hi weitong,
can you upload an example vi which shows this behavior?
Mike
0 Kudos
Message 4 of 11
(3,790 Views)
Looks like your data is written as SGL (look at the coercion dot at the file IO node!). You must have a pretty old LabVIEW version (pre 8.0?) where "write to spreadsheet file" internally used SGL format.
 
As a workaround, you should use "Array to spreadsheet file" using and write the resulting string to a file.
 
SGL precision is NOT sufficient to represent your numbers with the desired precision (see image). SGL is only good for about 6 digits, and you're having 9digits!
 
 
(Better yet upgrade to a newer LabVIEW version where this is no longer a problem. :))


Message Edited by altenbach on 04-10-2008 12:32 AM
0 Kudos
Message 5 of 11
(3,782 Views)
Hi Paul,

beside your good explanation: in your example you neither need a sequence structure nor a local variable! Just connect the constant to both indicators...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 11
(3,775 Views)
Thanks.After "array to spreassheet", how to write that to a file? by using "write characters to file.vi"?

Wei tong
0 Kudos
Message 7 of 11
(3,750 Views)
Yes, I got it.
0 Kudos
Message 8 of 11
(3,746 Views)
I know i dont need them 😛 but I put the stack and the local var to explain that the value in the register doesn't change when you have a specified digits of presition in the control or indicator. This is why i pass the number to the 3 dgitis of presition indicator, and then from it to the 9 digits of presition indicator showing that the number is still been the same.  I do that cause weitong said that the data he see in the array has 5 digits of presition, so maybe he was looking only the first 5 dgitis of presition. Anyway my english is not too good so maybe you don't understand me well 😛 . thanks 🙂
Paul
Mechatronic engineer
Lima-Perú
0 Kudos
Message 9 of 11
(3,728 Views)


Paul_m6 wrote:
 I do that cause weitong said that the data he see in the array has 5 digits of presition, so maybe he was looking only the first 5 dgitis of presition.
In any case, the number of displayed digits wasn't the problem here. The problem was the internal handling as SGL for the pre-8.0 "write to spreadsheet file". 🙂
0 Kudos
Message 10 of 11
(3,721 Views)