function deadLogIdx = identfyInactivePortIndexInLog(InputPortInfo, ssIOActivity)
 
    % Identifying inactive index in InputPortInfo generated during
    % subsystem logging. The index is used for not producing unnecessary signals
    % in generated harness model.
    
    %   Copyright 2014 The MathWorks, Inc.

    deadLogIdx = [];
    inactiveInportIndex = find(~ssIOActivity.Inport);
    try
        for i=1:length(InputPortInfo)
            if iscell(InputPortInfo{i})
                %Bus input, first field has struct info.
                blockPath = InputPortInfo{i}{1}.BlockPath;
            else
                blockPath = InputPortInfo{i}.BlockPath;
            end
            if isempty(blockPath)
                %global dsm signal
                continue;
            end
            switch get_param(blockPath,'BlockType')
                case 'Inport'
                    portNum = str2double(get_param(blockPath,'Port'));
                    if any(portNum == inactiveInportIndex)
                        deadLogIdx(end+1) = i; %#ok<AGROW>
                    end
                case 'DataStoreMemory'
                    dataStoreName = get_param(blockPath,'DataStoreName');
                    if ~any(strcmp(dataStoreName,ssIOActivity.DataStoreName.Active))
                        deadLogIdx(end+1) = i; %#ok<AGROW>
                    end
                case {'EnablePort','TriggerPort'}
                    % should be active
                otherwise
                    % ignore
            end
        end
        
    catch ex
        Mex = MException('ModelSlicer:ExportSlice:InvalidSimLogData',...
            getString(message('Sldv:ModelSlicer:Transform:InvalidSimLogData')));
        Mex = addCause(Mex,ex);
        throw(Mex);
    end
end
