We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi! So I've been playing around with importing files. I can't figure out why the rectangle in the draw isn't rendering.
For context, "filenames.txt" contains a long list of the names of the files I'm importing. These files are loaded and turned into arrays, then these arrays are separated into individual words which are then passed through the "emotions.csv".
I know that it has been properly importing the different files—I've tested by printing the filenames[r] and by printing the words that it's looking up in the "emotions.csv". I just can't figure out why it's not showing anything that I'm drawing, even when I put the rectangle at the start of the draw.
Table table;
void setup() {
size (100, 100);
background (255);
smooth ();
table = loadTable("emotions.csv", "header");
fill(0);
}
void draw(){
fill(0);
rect(0, 0, 10,10);
String[] filenames = loadStrings ("filenames.txt");
for (int r = 0; r < filenames.length; r++) {
String[] lines = loadStrings(filenames[r]);
for (int i = 0; i < lines.length; i++) {
lines[i] = lines[i].toLowerCase();
String[] list = splitTokens(lines[i], " &,+.:#<>[]1234567890~*()-@/_-%^$!{}|;'/");
for (int x = 0; x < list.length; x++) {
TableRow result = table.findRow(list[x], "Word");
if (result == null) {
}
else {
println(result.getInt("V.Mean.Sum"));
}
}
}
}
}
Answers
In a first glance I see that in line 15 you will load the text file as fast as your FPS (e.g. 60 times per second) so you can put this line inside setup function and make String[] filenames a global variable (put it after the Table table).
Thanks! It still doesn't seem to render the rectangle, though, but all the data still loads fine.
Here is some template code to help you, I don't know the data format you want to load, but if you say that it works you probably are OK.