07-13-2020 05:59 AM
Hello !
In my project, I receive a string with 3 values who are floats "FirstValue,SecondValue,ThirdValue".
In the output of my VISA Read I can read my 3 values correctly.
But at the output of my spreadsheet string to array I only have integers.
How can I keep my values into float at the output ?
Thanks.
Solved! Go to Solution.
07-13-2020 06:41 AM - edited 07-13-2020 06:45 AM
07-13-2020 06:46 AM
@Naxmouk wrote:
Hello !
In my project, I receive a string with 3 values who are floats "FirstValue,SecondValue,ThirdValue".
In the output of my VISA Read I can read my 3 values correctly.
But at the output of my spreadsheet string to array I only have integers.
How can I keep my values into float at the output ?
Thanks.
I don't understand your question. The output from your Spreadsheet String to Array is a DBL, not an integer. What made you think it was an integer? Is there some odd behavior that you are seeing? Please provide more details.
07-13-2020 06:52 AM
Thank you for attaching your code. It appears that it works perfectly, as expected. You didn't attach the vital "piece of the puzzle", the string that you read from VISA. Suppose you read the three floats, "1, 2, 3" (which are prefectly valid representations of the numbers 1.0000.., 2.0000.., 3.0000). In fact, try building an Array of Floats and putting the number 1, 2, 3 in it. Now look at the array -- you will not see any decimal points unless you tell it to display without hiding trailing zeros.
Bob Schor
07-13-2020 06:53 AM
Your values are definitely floats, as indicated by the orange wire coming out the right. Now if you need them formatted to a specified precision (decimal and zeroes after), you will have to add a little more code as Spreadsheet String to Array is limited in terms of what format strings you can use.
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.
07-13-2020 06:57 AM
Thank you for your answer,
The first 3 values are located after the spreadsheet to array, and the last value is at the output of the VISA read.
My values have "." as decimal separator.
I tried %;%f but it did not worked.
07-13-2020 06:59 AM
Hello !
Before the spreadsheet string to array I had 3 values separated by a comma. 2 of these values were floats, but after the spreadsheet string to array when I want to see my values using an index array I don't have my float anymore.
07-13-2020 07:03 AM
The small arrow at the corner of that bottom indicator means there is more to that string than what we can see. Could you copy the whole thing and post it here?
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.
07-13-2020 07:08 AM - edited 07-13-2020 07:09 AM
07-13-2020 07:21 AM
I believe I know what your problem is. Your localized delimiter is most likely comma, which LV gets straight from the language of your system. So what you will have to do is go through and replace the commas with some other symbol, then replace all your periods with commas, using Search and Replace String.vi. See below.
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.