clear all;
clc;
close all;

num_Tot_rilev=0;
x=[];
y=[];

fid = fopen('posMote.txt', 'r');
tline = fgetl(fid);

while num_Tot_rilev < 104;
   num_Tot_rilev = num_Tot_rilev+1;
   tline = fgetl(fid);
   v = findstr(tline,' ');
   if num_Tot_rilev <= 60
       a = v(1)+1;
       b = v(2)-1;
       if num_Tot_rilev <= 55
           c=  v(3)-1;
       else
            c = length(tline);
       end
   else
       a = v(4)+1;
       b = v(5)-1;
       c = length(tline);
   end
   x(num_Tot_rilev) = str2double(tline(a:b));
   y(num_Tot_rilev) = str2double(tline(b+2:c));
   if num_Tot_rilev == 60
       fseek(fid, 39, -1);
   end
end
fclose(fid);

training_Y_x=[];
test_Y_x=[];
training_Y_y=[];
test_Y_y=[];

l=1;
for k=1:2:103
    training_Y_x(l)=x(k);
    test_Y_x(l) = x(k+1);
    training_Y_y(l)=y(k);
    test_Y_y(l) = y(k+1);
    l=l+1;
end
training_Y_x=training_Y_x';
test_Y_x=test_Y_x';
training_Y_y=training_Y_y';
test_Y_y=test_Y_y';

save posizioniNM training_Y_x test_Y_x training_Y_y test_Y_y