String[] datos = loadStrings("data/Datos.txt");
int[] tabstop={25,100,180,220,250,280,310,340,370};
size(500,500);
fill(0);
for (int k = 0; k < datos.length; k++ ) {
String line = datos[k];
String[] tabs = split(line, '\t');
for (int i =0;i<tabs.length;i++ ) {
String t = tabs[i];
text (t, tabstop[i], (k+1)*20);
}
println(line);
}
Actually what I was looking for was an overprint of the data, as a visual support to the data that could already be seen graphically, the following code shows it, although I preferred to print a block with each data in a different line and then go over writing this whole block.
String []lineas;
String tabs[];
int x=0,y=0,frame;
void setup(){
size(300,300);
lineas=loadStrings("Datos.txt");
tabs=new String[lineas.length];
frameRate(100);
}// cierra setup()
void draw(){
if(frame<lineas.length){ // The screenshot show 1440; it is my files of everyday
background(125);
String t=lineas[frame];
for(String tb:tabs=split(t,'\t')){
text(tb,10,60+y*20);
y++;
}
y=0;
frame++;
}else{background(125);text("The End",10,60);}
}// cierra draw()
how about this example: Storing String Data in Arrays? ?
sorry that code is for a file with a header line,
and contains a cell editor you might not need
anyhow you never tell us where you get that data file from,
can it be created as
CSV ( “,” separator ) and also named .csv
have a meaningful header line
once the data are in a table ( array ) the output for swap rows / columns
should be more easy.
Table datos;
void setup() {
size(500,500);
datos = loadTable("data/Datos.txt", "tsv");
//}
// void draw() {
background(0);
for (int r = 0;r < datos.getRowCount() ; r++) for (int c =0;c < datos.getColumnCount() ; c++) text(datos.getString(r,c),10+c*60,(r+1)*20);
// for (int r = 0;r < datos.getColumnCount() ; r++) for (int c =0;c < datos.getRowCount() ; c++) text(datos.getString(c,r),10+c*70,(r+1)*20);
}
I apologize kll , the source file is a plain text file, “Datos.txt” that is identical to the one I attach, but with 1440 lines, it hasn’t header and the elements are separated with tabs.
The examples that you have given me I am saving them, they are interesting and I sure need them for another occasion.
I needed the data in the sketch, the result of this tip is the following:
It’s the black rect() to the left of the image.
It’s an automatic reproduction that shows the meteorological records along with its image (one per minute)
Thanks so much.