function combinedPlots(info,dirs)

files  = dir(dirs.output);
dirFlags = [files.isdir];
somnames = files(dirFlags);
somnames(ismember( {somnames.name}, {'.', '..'})) = [];  %remove . and ..
clear files

index_hydro = contains({somnames.name},'MS');
somnames_hydro = somnames(index_hydro);
somnames_morfo = somnames(~index_hydro);

%% Morfo table

VeroXB_all = [];
VeroMeas_all = [];
retreatXB_all = [];
retreatMeas_all = [];

for i=1:size(somnames_morfo,1)
    load([dirs.output filesep somnames_morfo(i).name filesep 'values.mat'])   
    try
        VeroXB_all(i,1) = VeroXB;
        VeroMeas_all(i,1) = VeroMeas;
        retreatXB_all(i,1) = retreatXB;
        retreatMeas_all(i,1) = retreatMeas;
    catch
        VeroXB_all(i,1) = NaN;
        VeroMeas_all(i,1) = NaN;
        retreatXB_all(i,1) = NaN;
        retreatMeas_all(i,1) = NaN;
    end
    clear VeroXB VeroMeas retreatXB retreatMeas 
end

save([dirs.output filesep 'skill.mat'], 'VeroXB_all','VeroMeas_all', 'retreatXB_all','retreatMeas_all');
dlm = {'VeroXB','VeroMeas', 'retreatXB','retreatMeas'};
rowlabel = {somnames_morfo.name}; rowlabel = strrep(rowlabel,'_', ' ');
matrix2latex([VeroXB_all, VeroMeas_all, retreatXB_all, retreatMeas_all], 'filename', 'skill.tex', ...
    'rowjustification','p{1.5cm}',...
    'rowlabel', rowlabel, ...
    'collabel', dlm, ...
    'format',	{'%s', '%4.2f', '%4.2f','%4.2f','%4.2f'});


%% Hydro plot
load([dirs.data filesep 'hydro_obs.mat']);

clrs = [0.9100    0.4100    0.1700;... % oranje
    0.4660    0.6740    0.1880;... %groen
    0.9290    0.6940    0.1250;... % geel
    0.8500    0.3250    0.0980]; % rood

poss = [1:5:31;4:5:34];

for par = 1:3    
    openfig([dirs.data filesep '2D_plot.fig'])
    count = 0;
    for j=1:numel(raai)
        index_som = find(contains({somnames_hydro(:).name}, [num2str(raai(j)) '_MS']));
        try
            load([dirs.output filesep somnames_hydro(index_som).name filesep  'xb_' somnames_hydro(index_som).name '.mat'])
        catch
            processed_xb = [];
        end
        
        for j2=1:2
            count = count +1;
                if j2 == 1
                    obscol = [0 0 0];
                else
                    obscol = [0.5 0.5 0.5];
                end
            
                try
                sp = subplot(7,5,poss(count):poss(count)+1);
                obstime = obs(j).time(j2,:);
                if par == 1
                    YY_obs = obs(j).wl(j2,:);
                    d = plot(obstime ,YY_obs,'o','color',obscol,'markersize', 3,'LineWidth',1.2);
                elseif par == 2
                    YY_obs = obs(j).HF(j2,:);
                    d = plot(obstime ,YY_obs,'ko','markersize', 3,'LineWidth',1.2);
                elseif par == 3
                    YY_obs = obs(j).LF(j2,:);
                    d = plot(obstime ,YY_obs,'ko','markersize', 3,'LineWidth',1.2);
                end
                clear obstime YY_obs
                catch
                    continue
                end
                grid on
                hold on
                
                if ~isempty(processed_xb)
                    time1D = processed_xb.time(j2,:);
                    if par == 1
                        YY = processed_xb.wl(j2,:);
                    elseif par == 2
                        YY = processed_xb.HF(j2,:);
                    elseif par == 3
                        YY = processed_xb.LF(j2,:);
                    end
                    p = plot(time1D,YY,'LineWidth',1.2,'color',clrs(1,:));
                    clear YY  
                end

                xlim([datenum(2019,01,08,00,0,0),datenum(2019,01,10,00,0,0)])

                if par == 1
                    ylabel('wl [m]');ylim([-0.5 3])
                elseif par == 2
                    ylabel('Hm0,SS [m]');ylim([0 2.5])
                elseif par == 3
                    ylabel('Hm0,IG [m]');ylim([0 1.5])
                end

                set(gca,'FontSize',8)

            if j==7
                sp.XTickLabel = '';
            else
                datetick('x','keeplimits','keepticks')
            end

        end
        clear processed_xb
    end
       
    lg = legend([d, p],{'Observations', 'XBeach results'}); lg.FontSize = 8;lg.Position = [0.62 0.85 0.1733 0.0671];
    set(gcf, 'Color', 'w');
    if par == 1
        print('-dpng','-r300',[dirs.output filesep 'XB_hydro_waterlevel'])  
%         xb_write_plot(gcf, dirs.output, ['XB_hydro_waterlevel'])
    elseif par == 2
        print('-dpng','-r300',[dirs.output filesep 'XB_hydro_Hm0SS'])  
%         xb_write_plot(gcf, dirs.output, ['XB_hydro_Hm0SS'])
    elseif par == 3
        print('-dpng','-r300',[dirs.output filesep 'XB_hydro_Hm0IG']) 
%         xb_write_plot(gcf, dirs.output, ['XB_hydro_Hm0IG'])
    end
    close all
end

end