-
• #2
The first time you call getArrayFromCSV it reads lines until it gets to the end of the file. The second time around it's already at the end of the file, so there are no more lines to read.
You can fix this either by reopening the file before each call, or by refactoring your function to pull out all the data you need in one pass.
-
• #3
Sat 2020.04.18
Well Good Morning @Purple-Tentacle. Did a quick hack as I don't have a device I am able to program that supports the 'Storage' module (yet) and works for me.
Did you try entering
csvFile
ordump()
at the command line?>t(1) [ "109", "109", "165", "165" ] return 109,109,165,165 >t(5) [ "11174", "11198", "11242", "11271" ] return 11174,11198,11242,11271
Rather than use the debugger, just peppered your function the ol' fashioned way, with my entries remaining far left for comparrison.EDIT:
It appears NebbishHacker posted the exact moment I did, and his analysis confirms what the hack also shows. Entering either commandcsvFile
ordump()
would show the contents of memory. Or, write to the WebIDE console as in the hack.
1 Attachment
-
• #4
The second time around it's already at the end of the file, so there are no more lines to read.
Yes, that was it.
Many thanks to both of you!
Hi,
I am reading a CSV file.
Then I create an array from the entries.
To get an array with the first column from all lines in a certain timeframe (diff <= history):
This works fine.
But as soon as I want to use the function for other columns, I only receive empty arrays ([]).
Example:
times is filled correctly, steps is an empty array.
I can call each one individually, but never more than 1.
What is wrong?
Thanks