I’ve been using Processing for years, but am stumped by what I think might be quite simple - I have searched but with no luck.
My aim is to take a list of string values from a column in a CSV and arrange them in a grid.
I can make a grid using for loops (as in code below), but all that happens in a nested loop is it repeats the first ten values.
For the sake of argument, let’s say the CSV has 100 rows. What I want to happen is the second row starts with the eleventh value from the CSV and we fill out the 10x10 grid with the 100 strings from the CSV.
Maybe a simpler way of looking at the problem is I’d like to arrange the numbers 1 - 100 consecutively in a 10x10 grid. Sample code (that isn’t quite right) below:
void setup() {
size(600, 600);
noLoop();
}
void draw() {
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
text(i + j, 100 + i * 20, 100 + j * 20);
}
}
}
It seems like it should be easy - hence me asking!
Hey thanks, for that I don’t want to replicate the layout of the CSV, I want to arrange the contents of one column in a grid. I just posted another code sample that may explain my query a bit better
Amazing, thankyou! Just the prompt I needed. I’ve now got the 1 - 100 problem sorted (code below). I can extrapolate this to my CSV thing. Thanks for the help!
int k = 1;
void setup() {
size(600, 600);
noLoop();
}
void draw() {
for (int j = 0; j < 10; j++) {
for (int i = 0; i < 10; i++) {
text(k, 100 + i * 20, 100 + j * 20);
k++;
}
}
}