function [outData] = transformDiscreteBlockInputProcessing(inData)
%

%  Copyright 2015-2018 The MathWorks, Inc.

% Transformation Function for old discrete blocks:
% 'Difference', "Discrete Derivative", "Transfer Fcn Real Zero" blocks.

outData.NewBlockPath = '';

instanceData = [];

if isfield(inData,'InstanceData')
    instanceData = inData.InstanceData;
    lenInstcData = length(instanceData);

    % Get the field type 'Name' from instanceData
    [ParameterNames{1:lenInstcData}] = instanceData.Name;

    % ------------------------------------------
    % As of R2018b, 'Inherited' choice no longer
    % supported for parameter 'InputProcessing'
    % ------------------------------------------
    if (~ismember('InputProcessing',ParameterNames)) 
        % Block did not previously have an 'InputProcessing' parameter.
        % Add it and set it to: 'Elements as channels (sample based)'.
        % As of R2018b, the 'Inherited' choice is no longer supported.
        instanceData(end+1).Name = 'InputProcessing';
        instanceData(end).Value  = 'Elements as channels (sample based)';
    else
        % Block already had an 'InputProcessing' parameter. If it was
        % previously set to 'Inherited', then set it instead to:
        % 'Elements as channels (sample based)'.
        for idx=1:lenInstcData
            % Find the value of the 'InputProcessing' parameter.
            if strcmp(instanceData(idx).Name, 'InputProcessing')
                % 'Inherited' choice is no longer supported as of R2018b.
                % Set it to choice 'Elements as channels (sample based)'.
                if ~isempty(strfind(instanceData(idx).Value,'Inherited'))
                    instanceData(idx).Value = ...
                        'Elements as channels (sample based)';
                end
                break; % DONE LOOPING
            end
        end
    end
end

outData.NewInstanceData = instanceData;
