www.gusucode.com > simulinkcoder 案例源码程序 matlab代码 > simulinkcoder/TuneParamsInteractivelyDuringRapidSimExample.m
%% Tune Parameters Interactively During Rapid Simulation % The RSim target was designed to let you run batch simulations at the fastest possible speed. % Using variable-step or fixed-step solvers with RSim combined with the use of a tunable % parameter data structure, whether you set *Default parameter behavior* to % |Tunable| or to |Inlined|, % you can create multiple parameter % sets to run with the RSim target's standalone executable file (.exe on Windows) generated % using Simulink Coder. Each invocation of the executable allows specification of the file % name to use for results. % % For this example, *Default parameter behavior* % is set to |Inlined|. The model declares workspace variables as tunable % parameters. To use RSim with *Default parameter behavior* set to % |Tunable|, and without explicitly declaring tunable parameters, see % <docid:simulinkcoder_examples.example-rtwdemo_rsim_batch_script>. %% Open Example Model % Open the example model |rtwdemo_rsim_param_tuning|. % Copyright 2015 The MathWorks, Inc. open_system('rtwdemo_rsim_param_tuning'); %% % This model uses the RSim target and the |rsimgetrtp| % function to allow a non real time executable to be passed new data without the need to % recompile the Simulink model. This feature allows you to get a map of the tunable % parameters declared in a model and save it in a MAT-file. You can then create your own % MATLAB GUI or a standalone GUI (independent of MATLAB) to read and write the MAT-file % and rerun the executable to produce new output files. % % Double-click the buttons at the upper right sequentially to run the example. % % To review the code % used to create both the MATLAB GUI and standalone GUI, double-click the View MATLAB programs button. % % For more information, you can also refer to the "Rapid Simulation Target" section in the % Simulink Coder documentation.