I've got a .txt file with always two values per line separated by tabs:
0 0
23 69
45 108
81 158
110 253
125 357
141 492
165 606
179 753
189 983
. .
0 0
4 31
33 38
45 89
60 115
75 166
93 201
107 216
116 291
133 366
148 480
170 631
196 720
207 994
. .
0 0
19 81
33 102
46 128
72 161
138 236
178 398
197 537
210 658
220 832
. .
0 0
24 38
40 90
71 166
99 193
etc.
Always beginning with 0 0 and ending with . . (80 times)
I'd like to read all the data in with Matlab. This is my code:
% Variab
line{1} = 0;
% Open files
fid = fopen(('D:\Dokumente\Studium\8. Semester\BA\Vali mit einzelenne punkten\alle.txt'), 'rt');
% Read Data
for i = 1:80
j = 1;
line = fgets(fid);
line = textscan(line,'%f %f');
while line{1} ~= '.'
digNum{i}(j) = line{1};
gewicht{i}(j) = line{2};
line = fgets(fid);
line = textscan(line,'%f %f');
j = j + 1;
end
end
So as you can see I want the left number to be saved as digNum{upOneValueWhen'.'}{numberIn'Vector'} and the right number gewicht{upOneValueWhen'.'}{numberIn'Vector'}.
Everything works fine but when I get to digNum = 46 (second to the last "vector") {upOneValueWhen'.'} goes up a number. I have no idea why. 'i' should only go up after '.' but for some reason it goes up at this one particular spot.
Any ideas??? Thank you so much in advance