Loading an array from CSV
in
Programming Questions
•
2 years ago
I have a program that appends 2 arrays when you click and drag the mouse.
One array logs the mouseX
The other logs the mouseY
I have been able to get it to save btoh arrays into 2 seperate CSV files like so:
- String[] s1 = new String[Xpos.length];
for(int i = 0; i < Xpos.length; i ++)
{
s1[i] = str(Xpos[i]);
}
saveStrings("Xpoints.csv", s1);
String[] s2 = new String[Ypos.length];
for(int i = 0; i < Ypos.length; i ++)
{
s2[i] = str(Ypos[i]);
}
saveStrings("Ypoints.csv", s2);
-
I know need it to load these files from the CSV's, however I am unsure how I would reverse the procces. I also think I will need to append the arrays for every value in the CSV as both arrays are declared as such:
-
int[] Xpos = new int [0];
int[] Ypos = new int [0];
1