function removeProperty(h, propstoremove)
% Remove the given property fro a view

%   Copyright 2010-2014 The MathWorks, Inc.

if isempty(h.Properties)
    return;
end
h.disableLiveliness;
viewProperties = copy(h.Properties);
for i = 1:length(propstoremove)
    property = h.getProperty(propstoremove{i});
    if ~isempty(property)
        if strcmp(property.Name, h.GroupName)
            h.GroupName = '';
        end
        index = strcmpi(get(viewProperties, 'Name'), property.Name);
        viewProperties(index) = [];
    end
end
h.enableLiveliness;
h.Properties = viewProperties;
