www.gusucode.com > rtwdemos 工具箱matlab源码程序 > rtwdemos/@RTWDemos/pcgd_configForSFun.m

    function pcgd_configForSFun(modelNum,setToMode)

%   Copyright 2007-2013 The MathWorks, Inc.
    
    % This function sets the configuration options required to
    % automatically generate an S-function wrapper for the model

    % 0.) get the base data
    pcgDemoData = evalin('base','pcgDemoData');
    
    % 1.) Validate that the model is open
    RTWDemos.pcgd_modelIsOpen(pcgDemoData,modelNum);
    cs = getActiveConfigSet(['rtwdemo_PCG_Eval_P',num2str(modelNum)]);    
    % 2.) Set the config set option to off
    if (setToMode == 1)
        % Generating the S-function wrapper
        cs.set_param('GenCodeOnly','off');
        cs.set_param('CreateSILPILBlock','SIL');
    elseif (setToMode == 2)
        % Generating code and exe (for zip file)
        cs.set_param('GenCodeOnly','on');
        cs.set_param('CreateSILPILBlock','None');
    elseif (setToMode == 3)
        % Generating code only
        cs.set_param('GenCodeOnly','on');
        cs.set_param('CreateSILPILBlock','None');
    end
        
end