| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Real-Time Windows Target |
| Contents | Index |
| Learn more about Real-Time Windows Target |
| On this page… |
|---|
Simulink external mode connects your Simulink model to your real-time application. The block diagram becomes a graphical user interface to the real-time application You can change parameter values while running the real-time application by changing the values in
Block parameters — Change block parameters by changing the values in the dialog boxes associated with the Simulink blocks. Once you change a value, and click OK, the new value is downloaded to the real-time application.
MATLAB variables — Change MATLAB variables by entering the changes through the MATLAB command line, and then press Ctrl+D for the changes to be downloaded to your executable. An alternative method to download parameters is to click Update Diagram from the Edit menu in your Simulink window. Simply changing the value of the MATLAB variable at the MATLAB command line is not sufficient for the Simulink software to know that the value has changed.
Simulink external mode also supports side-effects functions. For example, given an expression in a Gain block of 2*a+b, the expression is evaluated and the resulting value is exported to the real-time application during execution.
When a parameter in a Simulink model is changed, the communication module rtwinext.mex* transfers the data to the external real-time application and changes the model parameters. Only the parameters that do not result in model structure modification can be changed. If the structure is modified, you must recompile the model. Model structure changes are detected automatically using model checksum and reported to the MATLAB Command Window to avoid conflicts.
You must use Simulink external mode to change model parameters. While external mode is running, you can open Simulink blocks and change parameter values. External mode will transfer the new value to the real-time application.
Note Opening a dialog box for a source block causes Simulink to pause. While Simulink is paused, you can edit the parameter values. You must close the dialog box to have the changes take effect and allow Simulink to continue. |
After you start running your real-time application, you can change parameters and observe the changes to the signals. To start a real-time application, see Running a Real-Time Application.
The following procedure uses the Simulink model rtwin_model.mdl as an example. It assumes you have created a real-time application and are executing it.
From the Simulation menu, click Start Real-Time.
The real-time execution starts running and signal data is displayed in the Scope window.

From the Simulink block diagram, double-click the Transfer Function block.
The Block Parameters: Transfer Fcn dialog box opens:

In the Denominator field, change 70 to 30. Click OK.
The effect of changing a block parameter is shown in the Scope window.

![]() | Logging Signals to a Disk Drive | Boards, Blocks, and Drivers | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |