function [xstruct] = interpConfigVariables_lrauv(xstruct)

% ineterpCfg: extract and interp config variables
%--------------------------------------------------------------------------

cfgnames = {'buoyancyNeutral','massDefault','massPositionLimitAft',...
    'massPositionLimitFwd'};

for k=1:numel(cfgnames)
    
    clear tmp
    tmp.value = [xstruct.(cfgnames{k}).value]; % extract fixVars.
    tmp.time = [xstruct.(cfgnames{k}).time]; % extract fixVars.
    
    tmp.value = double(tmp.value);  % assert type double for interp
    
    if length(tmp.value)>1
        % fix time and interpolate to new time grid
        [tmp.time, tmp.value] = fixTimeseries(tmp.time, tmp.value);
        
        xstruct.(cfgnames{k}) = interp1(tmp.time, tmp.value, xstruct.time,'previous','extrap'); % <--!!!
        
    elseif length(tmp.value)==1
        xstruct.(cfgnames{k}) = repmat(tmp.value, size(xstruct.time));
        
    elseif numel(tmp.value)==0
        xstruct.(cfgnames{k}) = NaN(size(xstruct.time));
        
    else
        warning(['xstruct.' cfgnames{k} ': Record empty!'])
    end
end

end