[MATLAB]
I have a text file that is a list of numbers. Below is a sample but my actual file is a list of thousands of values, each on a new line.
0.01080000000
0.00720000000
0.05760000000
0.00360000000
How do I loop through this text file and input the data into a matrix of the size x = 431 and y = 415? Again, text file just has a list so every 431st number I need to go to a new row in my matrix.
clear;
%Load in text file
filename = 'Water_1973_points.txt';
T = fopen(filename);
%Count number of points in x,y (x = 431) (y = 415)
xsize = 431;
ysize = 415;
m=zeros(xsize, ysize);
tline = fgetl(T);
for k = 1:length(T)
for h = 1:xsize
for j = 1:ysize
m(h,j) = k*255;
end
end
end