Loading...
Logo
Processing Forum
Hello; 

Yes, I know this is like the most simple thing ever. However, I have spent literally hours searching for a simple answer. I've read and re-read the Learning Processing book, and the Visualizing Data (Fry) book. Yet the examples they describe use, like a 'class', or there is another tab in their file which the import process refers too, and there is no explanation on how or why. 

All i am trying to do is learn how to use and import the data that is in that file. Ideally to make a visualization (ie, bar chart, or something simple like that). 

Here is an example of how my data looks (either comma separated txt file, or comma separated .csv, or .tsv). the idea is the same;

one,two,three,four
100,200,300,400
110,220,330,440
200,255,256,401

If anyone can help i would be most grateful :),
thank you soo much! weezyF

Replies(5)

" how or why" there is another tab: just to avoid having too much code in a single file / screen, to keep things organized logically. It isn't mandatory, but just handy.

You use loadStrings() to get an array of lines.
Then, you loop on each line, and use split() on the current line to separate it in a list of fields, along the commas.
Thus, for each line, you get an array of strings, which you can convert to integers by using int().

What you do with these numbers is up to you, now.

Note: look at the recent messages: somebody made a bar graph sketch already. You can get inspiration from this code.
Is there a policy to use only pics that show yourself or graphics?

Thank you both Phi and Chri, very very much;

I finally got it thanks to you :)

As for the forum policy on pics, i think yall instate that rule of only being able to show them of yourself.

Yours truly, 
Weezy F Baby
You're welcome...

As for the pics - there's no such rule...