function D = fixInput(D,indices,values)
% Fix inputs to specified values, then eliminate.

%   Copyright 2023 The MathWorks, Inc.

% Absorb u-u0 contribution of discarded inputs
% Note: Contribution is zero where input is set to 'u0'.
ndel = numel(indices);
ufix = zeros(ndel,1);
jnum = find(cellfun(@(x) isnumeric(x),values));
ufix(jnum,:) = cat(1,values{jnum})-D.u0(indices(jnum),:);
D.dx0 = D.dx0+D.b(:,indices)*ufix;
D.y0 = D.y0+D.d(:,indices)*ufix;

% Delete channels
D.Delay.Input(indices,:) = [];
D.u0(indices,:) = [];
D.b(:,indices) = [];
D.d(:,indices) = [];
