Update Diagram and Run Simulation
You can leave many attributes of a block diagram, such as signal data types and sample times, unspecified. The Simulink® software then infers the values of block diagram attributes based on the block connectivity and attributes that you specify. The process that Simulink uses is known as updating the diagram.
Simulink attempts to infer the most appropriate values for attributes that you do not specify. If Simulink cannot infer an attribute, it halts the update and displays an error.
Simulink updates the diagram at the start of a simulation. The updated diagram provides the simulation with the results of the latest changes that you have made to a model.
Simulate the Model and View Results
Simulating performs the operations specified by the blocks in the model and its specific configuration and produces results. See Simulation for complete information, such as how to configure your model for simulation.
Use either of these methods to simulate a model:
Click Run .
In this example, the simulation runs for 10 seconds, which is the default setting.
Double-click both Scope blocks to open them and view the results.
The figures show the two results. In the second plot, the absolute value of the sine wave is always positive.
Update the Diagram While Editing
You can also update the diagram at any point while you create a model. Updating the diagram periodically can help you to identify and fix potential simulation issues as you develop the model. This approach can make it easier to identify the sources of problems by focusing on a set of recent changes. Also, updating the diagram takes less time than performing a simulation, so you can identify issues more quickly.
To update the diagram, from the Modeling tab, click Update Model. Alternatively, press Ctrl+D.
To see the effects of updating the diagram.
On the Debug tab, select Information Overlays > Base Data Types.
The data types of the output ports of the blocks appear. The data type of the ports is
double, the default value.
Double-click the Abs block.
In the Block Parameters dialog box, on the Signal Attributes tab, set Output data type to
singleand click OK.
The data type overlays on the block diagram do not show this change.
On the Modeling tab, click Update Model.
The updated block diagram shows the changes to the output data types of the Abs and Gain blocks.
The data type of the Gain block changes because the output data type of a Gain block is based on the data types of the input signal and the Gain parameter. In this example, the block uses the same data type as the input signal.