Read numeric value from CSV problem

I have file data_1.txt placed into internal storage. File contains 1 column of numbers like
0.612
0.753
0.823
0.542
…etc.
Each line ends with CRLF (hex 0D0A)
I am reading this file into a list with ‘LIST FROM CVS TABLE TEXT’ block
when I am taking the first item from this list it is displayed in label field as
[“0.612”]
and operator ‘IS NUMBER?’ returns FALSE. And numeric operators on this item throw error like
‘The operation > cannot accept the arguments: , [[“0.632”]], [1]’ (when trying to comapre the value with 1)

What I need to do to get a number ‘0.612’?

Because of the line returns, you have a list of lists, even though there is only one item in each sublist.
To get at the data, you need to dig a level deeper:

select list item list  select list item list  get global G_CSV
                index  1                index 1

Got it!
Thanks a bunch.
it is so awkward…is the any simpler way to read column of numbers from file without double conversion from list?

Just separate with commas instead before loading(put all the numbers in a row rather than a column), or you can convert the list of lists to a list using for each and list blocks.

I use set global myList to split text at \n in the File Data Arrived block.
From then on, we need only select item 1 from global myList to see the first, etc.

1 Like