function [simOut, covOut] = getSimulationResults(obj, simData)
% getSimulationResults returns the simulation results

% Copyright 2019-2021 The MathWorks, Inc.

    simOut = {}; %#ok<NASGU>
    covOut = {};

    if isa(simData, 'Simulink.Simulation.Future')
        % fetchOutputs is a blocking call but in this case our expectation
        % is that this call will not block execution since
        % getSimulationResults is being called only for those Future
        % objects that have finished execution
        simData = fetchOutputs(simData);
    end

    if obj.GetCoverage
        for eachSim = 1:length(simData)
            % store 'coveragedata' covOut if it is available
            if ~isempty(find(strcmp(string(simData(eachSim).who),"coveragedata"), 1))
                covOut{eachSim} = simData(eachSim).coveragedata; %#ok<*AGROW>
                simData(eachSim) = simData(eachSim).removeProperty('coveragedata');
            else
                covOut{eachSim} = [];
            end
            if obj.IsXilMode && obj.isBDExtractedModel
                covOut = obj.fixTopModelCovIdForXIL(covOut);
            end
        end
    end

    simOut= arrayfun(@(eachSim) {eachSim}, simData);
end

% LocalWords: coveragedata
