clear all
close all
clc

load('golf_data')

maand = 1:12;
jj = 0;

for i = 1:length(golf_data.naam)
    for j = 1:length(maand)
        jj = jj + 1;
        clear ind1 dum1 dum2 dum3 dum4 sdate edate jaar
        dum1 = [golf_data.t{i}];
        dum2 = [golf_data.Hs{i}];
        %%%
        dum3 = [golf_data.Tp{i}];
        dum4 = [golf_data.Ts{i}];        
        %%%
        jaar = datestr(dum1(1),'yyyy'); 
        sdate = datenum(['01-',num2str(maand(j),'%02.0f'),'-',jaar],'dd-mm-yyyy');
        if maand(j)~= 12
            edate = datenum(['01-',num2str(maand(j+1),'%02.0f'),'-',jaar],'dd-mm-yyyy');
        else
            edate = datenum(['31-',num2str(maand(j),'%02.0f'),'-',jaar],'dd-mm-yyyy')+1;
        end
        ind1 = find(dum1 >= sdate & dum1 < edate);
        data.naam(jj) = golf_data.naam(i);
        data.begin(jj) = {sdate};
        data.einde(jj) = {edate};
        data.jaar(jj) = {jaar};
        data.maand(jj) = {num2str(maand(j),'%02.0f')};
        data.dag(jj) = {dum1(ind1)};
        data.Hs(jj) = {dum2(ind1)};
        data.Tp(jj) = {dum3(ind1)};
        data.Ts(jj) = {dum4(ind1)};        
    end
end


% 
% for i = 1:0.5*length(data.naam)
%     figure
%     subplot(3,1,1)
%     plot(data.dag{i},data.Hs{i},'k-')
%     hold on
%     grid on
%     plot(data.dag{i+24},data.Hs{i+24},'r-')
%     %xlabel('dag')
%     ylabel('H_{1/3} (m)')
%     xData = data.begin{i}:2:data.einde{i};        
%     set(gca,'XTick',xData);
%     datetick('x','dd','keepticks')
%     ylim([0 1.5])
%     set(gca,'ytick',[0:0.5:1.5])        
%     title(['Golfcondities, ',datestr(data.begin{i},'mmmm yyyy')]);
% 
%     subplot(3,1,2)
%     plot(data.dag{i},data.Tp{i},'k-')
%     hold on
%     grid on
%     plot(data.dag{i+24},data.Tp{i+24},'r-')
%     %xlabel('dag')
%     ylabel('T_{p} (s)')
%     xData = data.begin{i}:2:data.einde{i};        
%     set(gca,'XTick',xData);
%     datetick('x','dd','keepticks')
%     ylim([0 10])
%     set(gca,'ytick',[0:2.5:10])    
%     %title(['Getij- en windcondities, ',datestr(data.begin{i},'mmm-yyyy')]);    
% 
%     subplot(3,1,3)
%     plot(data.dag{i},data.Ts{i},'k-')
%     hold on
%     grid on
%     plot(data.dag{i+24},data.Ts{i+24},'r-')
%     xlabel('dag')
%     ylabel('T_{1/3} (s)')
%     xData = data.begin{i}:2:data.einde{i};        
%     set(gca,'XTick',xData);
%     datetick('x','dd','keepticks')
%     ylim([0 10])
%     set(gca,'ytick',[0:2.5:10])  
%     %title(['Getij- en windcondities, ',datestr(data.begin{i},'mmm-yyyy')]);     
%     saveas(gcf,['EPS\golf_',datestr(data.begin{i},'yyyy-mm'),'.eps'],'psc2')
%     saveas(gcf,['PNG\golf_',datestr(data.begin{i},'yyyy-mm'),'.png'])
% end
% close all
