Loading large dataset from *.txt and string questions & problem //
in
Programming Questions
•
2 years ago
Hi there,
I'm trying to load a txt file with a million entry / lines, wondering if anyone as tried that before, and if it will be a problem ? or if there is better practices... ?
also i have started developing some simple code, but cain't seem to get past split()... problem with my string declaration or simple syntax... 'm a little lost...
thanks heaps in advance,,, sorry it might and probably is really obvious...
code below:
-
void setup() {size(550,550);}// load text file in data folder inside the sketch folde// String[] data = loadStrings("data.txt"); // load text file data into datatxt as stringvoid draw (){
String[] data = loadStrings("SmsValues_01.txt");//String data = "1,2,3,4,5,6,7,4,5,6,7,7,7,8,3,3,34,6,5,45,6,45,3,46,4";String[] smstxt = splitTokens (data); // breaks the datatxt string into smstxt[0]string for each valuesint [] smstxtINT = int(smstxt);
// debugprintln ("Raw"+ data + " ---- " + " Extracted ** " + smstxtINT [0] + " ** " + smstxtINT [1] + " ** " + smstxtINT [2] + " ** ");}
background(0);noStroke();smooth();For every value draw an ellipsefor (int i = 0; i < values.length; i++) {ellipseMode(CENTER);fill(values[i]*2,126);ellipse(width/2,i*3,values[i],8);}
data set (part of)
-12,-16,236
-15,-13,235
-17,-20,237
-11,-17,235
-13,-16,235
-13,-17,236
-13,-17,237
-13,-18,236
-15,-20,237
-15,-18,236
-13,-17,235
-15,-17,237
-15,-17,238
-13,-16,236
-13,-17,237
-15,-17,236
-15,-17,235
-16,-18,237
-15,-17,236
-15,-18,237
-12,-17,236
-13,-18,236
-13,-18,237
-13,-17,237
-15,-17,236
-15,-17,237
-13,-16,236
1