try 
    oetroot; 
catch 
    oetsettings; 
end

%-23.076, 98.721; 2515.959, 98.721

%non-specific
captions = {'bed elevation (m) \rightarrow'};
       
outputfigures = {'bed_elevation'};

polylineX = [-3.4153   -3.4153]; 
polylineY = [-5.0573   11.1027]; 
       
timesteps = [2];

files(1).full      = fullfile(pwd, '..\..\dflowfmoutput\str_map.nc');
files(1).diagnosis = fullfile(pwd, '..\..\str.dia');
files(1).type = 'Delft3D FM';
files(1).fields = {'Time-varying bottom level in flow cell centers - nmesh2d_face: mean'};
files(1).legend = get_delft3d_version_from_log(files(1).diagnosis);

files(2).full = fullfile(pwd, '..\..\delft3d\trim-str.dat');
files(2).diagnosis = fullfile(pwd, '..\..\delft3d\tri-diag.str');
files(2).type = 'Delft3D 4';
files(2).fields = {'bed level in water level points'};
files(2).legend = get_delft3d_version_from_log(files(2).diagnosis);

              
for k = 1:length(files)
    assert(length(files(k).fields) == length(captions),sprintf('File %i has different number of fields than the number of captions',k))
    legstr{k} = files(k).legend;
end
assert(length(outputfigures) == length(captions),sprintf('number of output figures different than the number of captions'))

%%
colors = linspecer(length(files),'qualitative');

%%  openfiles 
d3d_qp('close')
for k = 1:length(files)
   d3d_qp('openfile',files(k).full);
end

%% plotting;
for t = timesteps;
    for f = 1:length(captions); 
        for k = 1:length(files);
            d3d_qp('selectfile',files(k).full);
            d3d_qp('selectfield',files(k).fields{f})
            d3d_qp('hselectiontype','(X,Y) point/path')
            d3d_qp('editxy',[polylineX(:),polylineY(:)])
            d3d_qp('axestype','X-Val')
            d3d_qp('editt',t)
            d3d_qp('colour',colors(k,:))
            if k == 1; 
                d3d_qp('quickview')
            else
                d3d_qp('addtoplot')
            end
        end
        ylabel(captions{f});
        legend(legstr,'Location','Best');
        title('');
        d3d_qp('printfigure',sprintf('%s_%i.png',outputfigures{f},t),'PNG file',2,300,1,1,1)
    end
end
%%