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

    function [flags, Funcs, Order] = getFlags
%GETFLAGS  Get the flag definitions
%
%  F = GETFLAGS returns a structure whose fields are the names of the flags
%  that can be set on the sweepsetfilter and contain the corresponding
%  index to use for setting and accessing that flag.
%
%  [F, FUNCS, ORDER = GETFLAGS also  returns a cell array of update
%  function handles, one for each flag, and a vector of the same length
%  indicating in which order they should be applied.  The update functions
%  correspond to the indices provided by the flags in F. Similarly, the
%  ORDER vector is a permutation of these flags.

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


persistent pFlags
persistent pFuncs
persistent pOrder


if isempty(pFlags)
    pFlags = struct('APPLY_DATA', 1, ...
        'APPLY_VARS', 2, ...
        'APPLY_FILT', 3, ...
        'APPLY_TEST', 4, ...
        'APPLY_SFILT',5, ...
        'APPLY_REOR', 6, ...
        'APPLY_DERIVED', 7, ...
        'APPLY_SVAR', 8, ...
        'APPLY_RESAMP', 9 );

    pFuncs = cell(1, length(fieldnames(pFlags)));
    pFuncs{pFlags.APPLY_DATA}   = @updateModifiedData;
    pFuncs{pFlags.APPLY_VARS}   = @updatevariable;
    pFuncs{pFlags.APPLY_FILT}   = @updateFilter;
    pFuncs{pFlags.APPLY_TEST}   = @updateDefineTests;
    pFuncs{pFlags.APPLY_SVAR}   = @updateSweepVariables;
    pFuncs{pFlags.APPLY_SFILT}  = @updateSweepFilters;
    pFuncs{pFlags.APPLY_REOR}   = @updateReorderSweeps;
    pFuncs{pFlags.APPLY_RESAMP} = @updateResampling;
    pFuncs{pFlags.APPLY_DERIVED}= @pSweepsetfilterChanged;

    pOrder = [...
        pFlags.APPLY_DATA, ...
        pFlags.APPLY_VARS, ...
        pFlags.APPLY_FILT, ...
        pFlags.APPLY_TEST, ...
        pFlags.APPLY_SVAR, ...
        pFlags.APPLY_SFILT, ...
        pFlags.APPLY_REOR, ...
        pFlags.APPLY_RESAMP, ...
        pFlags.APPLY_DERIVED, ...
        ];
    
end
flags = pFlags;
Funcs = pFuncs;
Order = pOrder;