08-26-2010 10:56 AM
I apologise for not having code to post right now - I will do that from work tomorrow. But there is a previous thread that describes the same issue that I just found:
http://forums.ni.com/t5/LabVIEW/Wrong-result-after-convert-variant-to-double/m-p/953419
I have a compiled LabVIEW program that runs just fine on an English-language computer - it loads floating point numbers from either (European-formatted) CSV files or Excel xls(x) spreadsheets, communicating with Excel using ActiveX in both cases. What I see is exactly what is seen in the above thread - the Variant values are displayed on the Front Panel with the Decimal point, but when you convert the variant array to a double array, the number is interpreted incorrectly and the decimal separator is ignored.
In otherwords if the Excel file had a value 4.556 (which is formatted as 4,556 in the European files), a Variant Indicator on the front panel displaying the value would display "Value->4.556E+00", but if you then convert it to a double, it would be interpreted as 4556 (or 4.556E+03) (4 thousand 5 hundred and 56). The LabVIEW program is using the European locale settings for displaying other floating point values on the front panel. It seems that LabVIEW is forgetting to use the Locale settings in the Variant->Double conversion (or some other inconsistency). Why does it display it ok in the Variant Indicator, but then get mis-interpreted?
08-26-2010 11:55 AM
08-26-2010 12:55 PM - edited 08-26-2010 12:56 PM
Maybe the OP has eye trouble and needs to have BIG font in order to read. I knew a guy with retinal damage, and he had to use big fonts. He had no choice. Even glasses would not help much.
@pauldavey. Sorry I don't know the answer to your question.
08-26-2010 12:57 PM
I am digging it on my iPhone...
08-26-2010 05:17 PM
ROFL!! Guys...
😄
Simply mention that smaller fonts should be used and let's help this person..
Sorry.. I just had to laugh, it was funny, and I think everyone needs laughter these days..
🙂
08-27-2010 12:01 AM
Sorry - I had trouble with a conflict between font size and web browser magnification (I pressed Ctrl Y and it all went downhill from there). If I could still edit the post I would. I have had trouble trying to reproduce it since I have a Windows machine using English.
08-27-2010 01:51 AM
How do you convert it back? Ordinary Variant to Data? If you unflatten you'll get the decimal comma and later transforms will get messed up.
I've had some problems with outsmarting LV due to such inconsistencies which later on outsmarted me.
/Y
08-27-2010 02:34 AM
Thanks for your reply. I am simply using the Variant To Data function to convert the Variant (from the Value2 property of the range) to a 2D DBL array. I have tried changing the language on my computer to German with German local settings, and everything looks German, with commas for decimal and dots for thousands (and swapping the Z and Y keys on my keyboard!). But on my computer everything works flawlessly. We are going to try changing the German computer to use English and see if that works.
Paul
08-27-2010 03:46 AM
If the only difference is the comma/point and not thousand separators (1,000.00 vs 1'000,00) then you could try the following:
Use Unflatten variant -> (String part) Replace string 'comma to point' -> String to number with "Use regional setting" set to false.
/Y