Loading data into the processing


Im trying to load some data from a csv file.
The data tab contains this code:

Table data=loadTable("values.csv");
TableRow row=data.getRow(0);
float x1=row.getInt(0);
float y1=row.getInt(1);
float x2=row.getInt(2);
float y2=row.getInt(3);
float x3=row.getInt(4);
float y3=row.getInt(5);
float x4=row.getInt(6);
float y4=row.getInt(7);
float x5=row.getInt(8);
float y5=row.getInt(9);
float x6=row.getInt(10);
float y6=row.getInt(11);
float x7=row.getInt(12);
float y7=row.getInt(13);
float x8=row.getInt(14);
float y8=row.getInt(15);
int a=row.getInt(16);
int b=row.getInt(17);

And what I get is this error:

What could be the problem here?

1 Like

I’ve spotted this red error message: :sunglasses:

Files must be loaded inside setup() or after it…

1 Like

For simplicity, just put your row.getint() calls directly into your drawingFunc arguments. No need for 12 extra global variables – row is the variable. If you want to make it more readable you can name the table columns and get them by column name.

1 Like