Hello everyone. Completely new to P5JS. I am trying to create a table and populate it with data already collected by the same code.The table will have three columns: name, position_x, and position_y.
The code below didn’t get me any errors. However, I am not sure if it is correct.
let myTable = new p5.Table([name,let position_x,let position_y]);
So, if coding below is correct, how do I tell P5js to start reading my previously storaed data and place it on my myTable one row at the time?
Sorry if I am not clear enough.
I’ve made a sketch that stores and reads an array of CSV row strings from the browser’s local storage using storeItem() & getItem() respectively; then converts that array to p5.TableRow objects; and finally use p5.Table::addRow() to populate a p5.Table container:
Yes, the data is already provided by the code, which reads “some predefined” pixels from an image in the form of [name, posx,posy]. What I m looking for is to store those specific pixels to a CSV file. I noticed your code requires the mouse to add rows and the keyboard to save the file when “s” is pressed. Is there anyway to feed the table with those specific pixels without the user’s input?
amh, not get the CSV file thing,
if you have that data as a CSV file already the whole question makes no sense.
you not say how you get that data into what kind of array
you not link to your working/testing online project
the place of the function inside the sketch.js file does not matter
( as long it is not inside a other function…)
but the valid question is from where you call it?
as you not want any user interaction,
you must call it directly after the
without make your project available it is very difficult to help,
and i did write for you a set of functions regarding table already to give you a start…
now you just have to feed other data?
Sorry I was out of my base, but I’m back. I commented out line 67 because I don’t know where exactly to place it. https://editor.p5js.org/hbtousa/sketches/sn1QLACNg
I will rephrase the question, or the problem, I have and the reason why I didn’t mention the CSV part first. Since the code provides the data, I thought building a table off it was a basic task. With a table fully loaded I wouldn’t see a problem saving the data as CSV file it to my local PC.but, as of right now still digging to get it done. Sorry for all the inconvenience.