www.gusucode.com > simulink 案例源码程序 matlab代码 > simulink/SimulateModelwithsimCommandLineOptionsinConfigurationSetExample.m
%% Simulate Model with |sim| Command-Line Options in Configuration Set % Simulate the model, |vdp|, in Rapid Accelerator mode for an absolute % tolerance of |1e-5| and save the states in |xoutNew| and the output in |youtNew|. % % Specify parameters as name-value pairs in configuration set |mdl_cs| for the % |sim| command: mdl = 'vdp'; load_system(mdl) simMode = get_param(mdl, 'SimulationMode'); set_param(mdl, 'SimulationMode', 'rapid') cs = getActiveConfigSet(mdl); mdl_cs = cs.copy; set_param(mdl_cs,'AbsTol','1e-5',... 'SaveState','on','StateSaveName','xoutNew',... 'SaveOutput','on','OutputSaveName','youtNew') simOut = sim(mdl, mdl_cs); set_param(mdl, 'SimulationMode', simMode)