function mdldiscdemoscript(action)
%

% Copyright 2005-2012 The MathWorks, Inc.

persistent mdldiscwindow;

if nargin ~= 1
    error(message('simdemos:mdldiscdemoscript:noAction'));
end

switch action
    case 'open'
        slexAircraftExample;
    case 'opendisc'
        mdldiscwindow = slmdldiscui('slexAircraftExample');
    case 'viewnext'
        mdldiscwindow.setRunMatlabSync(0);
        mdldiscwindow.setTreeNodeAt(1);
        mdldiscwindow.setRunMatlabSync(1);
    case 'disccurr'
        mdldiscwindow.setRunMatlabSync(0);
        mdldiscwindow.fMdlDisc.allEvaluated = true;
        mdldiscwindow.click(mdldiscwindow.getToolButtonAt(7));
        mdldiscwindow.setTreeNodeAt(0);
        mdldiscwindow.setRunMatlabSync(1);
    case 'actmdl'
        mdldiscwindow.setRunMatlabSync(0);
        mdldiscwindow.setTreeNodeAt(1);
        open_system(sprintf('slexAircraftExample/Actuator\nModel'));
        mdldiscwindow.setRunMatlabSync(1);
    otherwise
        fprintf('Unknown action %s in mdldiscdemoscript\n',action);
end
