function isModel = isSimulinkModel(sid)
% ISSIMULINKMODEL Return true if the SID resolves to a loaded Simulink model.

%    Copyright 2012-2018 The MathWorks, Inc.


if nargin > 0
    sid = convertStringsToChars(sid);
end

isModel = false;
try
    modelName = Simulink.ID.getModel(sid);
    mdlObj = get_param(modelName,'Object');
    if isa(mdlObj,'Simulink.Object')
        isModel = true;
    end
catch e  %#ok<NASGU>
    % ignore error. Model doesn't exist or is not loaded.
end


