12-09-2011 10:46 AM
Solved! Go to Solution.
12-09-2011 10:51 AM
12-09-2011 10:52 AM
What function are you using to convert?
You might be telling it to only return intergers.
Your code was not posted
12-09-2011 11:35 AM - edited 12-09-2011 11:37 AM
To me, it's VERY unintuitive, but you must use "Fract/Exp String To Number" instead of "Decimal String To Number." While technically, "decimal" stands for "base10," I think most people interpret it as a number with a decimal point. LabVIEW uses "decimal" as it does "octal" and "hexadecimal," which is intirely correct, but confusing.
12-09-2011 11:49 AM
@billko wrote:
To me, it's VERY unintuitive, but you must use "Fract/Exp String To Number" instead of "Decimal String To Number."
That is one possibility.
How are you reading the file? You should also make sure that your localized decimal point is corrrectly handled. Some countries use a period (1.234) and other use a comma (1,234) as decimal seperator and an incorrect setting will drop all fractional parts. Can you attach a typical text file?
12-27-2011 07:57 AM
Here in Brazil we use commas instead of points for decimal seperation. Ive tried using a search/replace VI to work with both but the end result is the same.
Hmm my company's IT department has restricted the internet in a way that I cant upload anything. I'll walk you through the ultra-simple block diagram.
1) I open the *.TXT file using an OPEN/CREATE/REPLACE VI
2) I use a Read From Text File.VI to read the data and a Replace SubString.VI to exclude 11 characters of header at the begining of my file
3) I now have a string with a couple thousand of lines each line corresponds to a point which I intend to plot on a graph. here Ive tried two different ways of handling the data both producing the same results, method 1 was using the Spreadsheet String to Array.VI and method 2 was opeing a for loop and choosing the Pick Line.vi followed by a Decimal String to number.vi
In both cases a number that originally is -6.7845132 on my string is displayed as -6 by my numeric indicator.
Again it doesnt matter wether I used -6,7845.... or -6.7845... the end result is still -6
12-27-2011 08:11 AM - edited 12-27-2011 08:12 AM
@bnoronha wrote:
followed by a Decimal String to number.vi
That's your problem. As previously stated by Bill, you need to use the Fract/Exp String to Number function. Please use the LabVIEW Help. It would have told you what that function does.
I don't quite understand all of the gymnastics you are doing with trying to read the file. Why are you using Replace SubString to remove the first 11 characters? String Subset would be more appropriate. Have you tried simply using Read From Spreadsheet File? You can change the format string to specify localization codes (see the LabVIEW Help).
12-27-2011 08:44 AM
Wow I feel like a dunce...
Fract/Exp String worked. I guess I saw decimal and figured that the solution was there...
for some reason I figured that Read From Spreadsheet couldnt be used for *.txt files.
Replaced 5 .VIs with one.
many thanks
05-23-2012 02:37 PM
I think this is somewhat the same problem that I have. I'm also using Decimal String to Number and my input is a string array with a bunch of the same data which is 32,768. When it goes through the Decimal String to Number, it rounds it to 32 and this number is being manipulated further, but I do not want it to be a 32. I would prefer it to be 32.768. (Scaling is included so of course it is actually 32,000 and 32,768 respectively). I have tried replacing my Decimal String to Number but I still get an array of 32. Any ideas?
05-23-2012 02:40 PM
I replaced the Decimal String to Number with the Fract/Exp String to Number block***