Main Content

Update Diagram and Run Simulation

Updating the Diagram

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.

Simulation Updates the Diagram

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.

Update Diagram While Editing

As you create a model, at any point you can update the diagram. 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, the update diagram processing takes less time than performing a simulation, so you can identify issues more efficiently.

To update the diagram, from the Modeling tab, click Update Model, or press Ctrl+D.

This example shows the effects of updating the diagram.

  1. Create the following model.

  2. On the Debug tab, select Information Overlays > Base Data Types.

    The data types of the output ports of the Constant and Gain blocks appear. The data type of both ports is double, the default value.

  3. In the Constant block dialog box, set Output data type to single.

    The output port data type displays on the block diagram do not show this change.

  4. On the Modeling tab, click Update Model.

    The updated block diagram shows the changes to the output data types of the Constant and Gain blocks.

    When you update a block diagram, by default, a Gain block chooses an output data type based on the data types of the input signal and the Gain parameter. In this example, the block chooses the same data type as the input signal.

Simulate a Model

For any type of model you build in Simulink, you need to know how to simulate. 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:

  • Press Ctrl+T.

  • Click Run .

Related Topics