www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/cgStrategyTables.m

    function varargout = cgStrategyTables(Style)
%CGSTRATEGYTABLES set style for strategy parser behavior 
%
%   cgStrategyTables(Style) 
%    where style can be 'R2013a, 'R2008a' or 'Pre-R2008a'. 
%
% Pre-R2008a, the CAGE strategy parser interpreted 1D tables as normalizers if
% they fed into a lookup table. In R2008a, a normalizer block was added to
% cgeqlib and lookup table blocks are now always interpreted as lookup 
% tables. This change creates an incompatibility for any strategies saved
% as Simukink files and re-imported into CAGE. Use this function if you need to
% parse pre-R2008a strategies.
% In R2013a the order of the inputs for 2D lookup tables was changed to be consistent with Simulink.
% 
%
% The current strategy table style can be queried using: 
%   Style = cgStrategyTables;
%
% Setting Style to 'Pre-R2008a' reverts the parser behavior to the pre-R2008a 
% interpretation of 1D lookup tables. A warning is issued when a 1D table 
% is converted to a normalizer. The warning may be turned off with
%
% warning off mbc:cgslparser:ObsoleteNormalizer

%  Copyright 2008-2012 The MathWorks, Inc. and Ford Global Technologies, Inc.

if nargin
    switch lower(Style)
        case 'r2013a'
            setpref(mbcprefs('mbc'),'StrategyTableStyle','R2013a');        
        case 'r2008a'
            setpref(mbcprefs('mbc'),'StrategyTableStyle','R2008a');
        case 'pre-r2008a'
            setpref(mbcprefs('mbc'),'StrategyTableStyle','pre-R2008a');
        otherwise
            error(message('mbc:cgStrategyTables:InvalidStyle'))
    end
else
    varargout{1} = getpref(mbcprefs('mbc'),'StrategyTableStyle');
end