www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@sweepsetfilter/getAllows.m

    function values = getAllows(obj, Properties)
%GETALLOWS Get flag values
%
%  VALUES = GETALLOWS(SSF) 
%  VALUES = GETALLOWS(SSF, PROPERTIES)
%
%  Examples:
%    struct = getAllows(ssf)
%    double = getAllows(ssf, 'variables')
%    cell_array = getAllows(ssf, {'variables', 'filters'})
%
%  See also SWEEPSETFILTER, SWEEPSETFILTER/SETALLOWS. 

%  Copyright 2000-2011 The MathWorks, Inc. and Ford Global Technologies, Inc.


[valid_props, prop_flags] = allowsProperties;

% Have we got any properties?
ALLPROPS = nargin < 2;
if ALLPROPS
	Properties = valid_props;
end

ISCHAR = ischar(Properties);
if ISCHAR
	Properties = {Properties};
end

values = cell(1,length(Properties));
Properties = lower(Properties);

% Get flag settings
f = getFlags;

for i = 1:length(Properties)
	property = Properties{i};
    mInd = find( strncmp( property,valid_props,length(property) ) );
    if isempty(mInd) || length(mInd) > 1
        error(message('mbc:sweepsetfilter:InvalidPropertyName1', property));
    end
    values{i} = double( bitget( obj.allowsFlag, f.(prop_flags{mInd}) ) );
end

if ISCHAR
	values = values{1};
end

if ALLPROPS
	values = cell2struct(values, valid_props, 2);
end