function imatch = mpc_checkpropmatch(Property, AllProps, type)
    % Issues a standardized error message when the property name
    % PROPERTY is not uniquely matched.
    
    % Authors:  A. Bemporad, N.L. Ricker, R. Chen
    % Copyright 1994-2020 The MathWorks, Inc.
    
    imatch = find(strncmpi(Property,AllProps,length(Property)));
    nhits = length(imatch);
    if nhits==1
        return
    elseif nhits==0
        if strcmp(type,'get')
            ctrlMsgUtils.error('MPC:object:GetNoPropertyName',Property);    
        else
            ctrlMsgUtils.error('MPC:object:SetNoPropertyName',Property);    
        end
    else
        if strcmp(type,'get')
            ctrlMsgUtils.error('MPC:object:GetAmbiguousPropertyName',Property);
        else
            ctrlMsgUtils.error('MPC:object:SetAmbiguousPropertyName',Property);
        end
    end
end
