www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregdynlolimot/modelactions.m

    function actions = modelactions( m, ms ) %#ok<INUSL>
%modelactions - model actions specific to model type
%   actions= modelactions(m,ms)

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

actions = [mbcgui.actions.StatefulAction(@(h,evt) i_ViewCenters(ms),'&View Centers','View Centers','viewCenters.bmp')
    mbcgui.actions.StatefulAction(@(h,evt) i_lolimotpoles(ms),'LOLIMOT &Poles','LOLIMOT &Poles','')
    mbcgui.actions.StatefulAction(@(h,evt) i_plottree(ms),'LOLIMOT &Tree','LOLIMOT tree','')];
        


%------------------------------------------------------------------------------|
function i_lolimotpoles( ms )

m = ms.Model;

T = [];

if isa( m, 'xregarx' ),
    T = 1/get( m, 'Frequency' ); % sample rate
    m = get( m, 'StaticModel' );
elseif ~isa( m, 'xregdynlolimot' )
    errordlg( 'Model at current node does not support ''LOLIMOT Poles''', ...
        'Sorry' );
end
if poles( m, 'Enable' ),
    figh = poles( m, 'Figure', fullname(ms.ModelDev), T );
    registerSubFigure(ms, figh );
else
    errordlg( ['Only ARX LOLIMOT models with non-zero feedback and ', ...
        'linear beta models support poles.'], ...
        'LOLIMOT Poles' );
end
return

%------------------------------------------------------------------------------|
function i_plottree( ms )

m = ms.Model;

if isa( m, 'xregarx' ),
    m = get( m, 'StaticModel' );
elseif ~isa( m, 'xregdynlolimot' )
    errordlg( 'Model at current node does not support ''LOLIMOT Tree plot''', ...
        'Sorry' );
end
figh = plottree( m, 'Figure', fullname(ms.ModelDev) );
registerSubFigure(ms, figh );

return

%------------------------------------------------------------------------------|
function i_ViewCenters(ms )
% src is the menu handle
% evt is empty

p = ms.Pointer;
m = model( p.info );

if isa( m, 'xregarx' ),
    m = get( m, 'StaticModel' );
end
if ~isa( m, 'xregdynlolimot' ),
    errordlg( 'ViewCenters for dynamic LOLIMOT called for invalid model type', ...
        'Invalid model' );
    return
end

figh = viewcenters( m );
ms.registerSubFigure( figh );

return


%------------------------------------------------------------------------------|
% EOF
%------------------------------------------------------------------------------|