clear all
close all
clc

set_dir = 'D:\werf_je\Werk\1.201.819-Proefsuppletie_Galgeplaat_2e_evaluatie\Data\SET';
set_xy = load(fullfile(set_dir,'set_xy.txt'));
i = 0;
for file = dir(fullfile(set_dir,'*.xls'))'
    i = i + 1;
    clear num txt
    [num, txt]= xlsread(fullfile(set_dir,file.name),'Data');
    set_data.datum(i) = {datenum(char(txt{2:end,2}),'dd-mm-yyyy')};
    set_data.naam(i) = {num2str(str2num(strrep(file.name,'.xls','')),'%03.0f')};
    if ~isempty(find(set_xy(:,1) == str2num(set_data.naam{i})))
        set_data.x(i) = set_xy(find(set_xy(:,1) == str2num(set_data.naam{i})),2);
        set_data.y(i) = set_xy(find(set_xy(:,1) == str2num(set_data.naam{i})),3);
    else
        set_data.x(i) = NaN;
        set_data.y(i) = NaN;
    end
    set_data.z(i) = {num(3:end,1)};
end

%Even sorteren
[set_data.naam ind] = sort(set_data.naam);
set_data.datum = set_data.datum(ind);
set_data.x = set_data.x(ind);
set_data.y = set_data.y(ind);
set_data.z = set_data.z(ind);

figure
plot(set_data.x,set_data.y,'ko','MarkerFaceColor','k')
hold on
axis equal
xlabel('xRD')
ylabel('yRD')
text(set_data.x+1e1,set_data.y+1e1,set_data.naam)
title('Locaties SET metingen')

save MAT\set_data set_data