function analyze_this(info, dirs)

% read measurements
M = load(fullfile(dirs.data, [info.run 'data.mat']));
t = [0 .1 .3 1 2.04 6];

% read dimensions
d       = xb_read_dims;
[m i]   = closest(1000+t*3600, d.t);

% read input
xbi     = xb_read_input(pwd);
zs0     = max([0 xs_get(xbi,'zs0') max(xs_get(xbi,'zs0file.tide'))]);

% read output
xbo1    = xb_read_output(pwd, 'vars', {'zb'}, 'index', i-1);
xbo2    = xb_read_output(pwd, 'vars', {'zb'});
xbo3    = xb_read_output(pwd, 'vars', {'zs' 'zb' 'H' 'u' 'ue' 'urms' 'hh_var'});

% analyze output
xbb     = xb_get_morpho(xbo2, 'level', zs0);
xbw     = xb_get_hydro(xbo3, 'Trep', xs_get(xbi, 'Trep'));

A = [];
for i = 1:size(M.z,1)
    A(i) = sum(max(0,M.z(1,:))-max(0,M.z(i,:)))*1;
end

% plot output
xb_plot_profile(xbo1, ...
    'measured', [M.x' M.z']);

xb_write_plot(gcf, dirs.output, 'profiles');

id = find(strcmp({xbb.data.name}, 'ero'),1); % find which row contains 'ero'
xbb.data(id).value = abs(xbb.data(id).value); %take abs of erosion - seems to solve problem with pictures, quick & dirty fix

xb_plot_morpho(xbb, ...
    'dz', [M.x' M.z(end,:)'-M.z(1,:)'], ...
    'ero', [t' A']);

xb_write_plot(gcf, dirs.output, 'morpho');

xb_plot_hydro(xbw, ...
    'Hrms_hf', [M.xhrms' M.Hrms_hf'], ...
    'Hrms_lf', [M.xhrms' M.Hrms_lf'], ...
    'Hrms_t', [M.xhrms' M.Hrms'], ...
    's', [M.xsetup' M.setup'], ...
    'umean', [M.xum' M.Um'], ...
    'urms_lf', [M.xurms' M.Urms_lf'], ...
    'urms_hf', [M.xurms' M.Urms_hf'], ...
    'urms_t', [M.xurms' M.Urms']);

xb_write_plot(gcf, dirs.output, 'hydro');

% remove all but the first and last outputs
for iv = 2:length(xbo1.data)
    if length(size(xbo1.data(iv).value)) == 3
        xbo1.data(iv).value = xbo1.data(iv).value([1 end],:,:);
    end
end

xb_plot_profile(xbo1,'measured',[M.x' M.z(end,:)'])
title(['profiles ' info.test ' ' info.run], 'interpreter', 'none')
xb_write_plot(gcf, dirs.output, 'final_profiles')