If I have a text file that looks like:
4
1 2 3
4 5 6
7 8 9
10 11 12
I want to read each column of numbers into a variable x, y, and z. So after reading, z = [3, 6, 9, 12].
How do I parse through the text file to store every row of each column in its own variable?
So maybe store the entire text file as string with "/n" for each line, then parse x=sting[i], y=string[i+1], z=string[i+2] for each line? or something similar to that.
I think there must be a better way to do this, especially for when n is very big.
~ (edit) The first number at the top (4 in this case) determines how many rows the text file will have. So if I set n=4, then have a for loop: for(i=0; i