Update a Block Diagram

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 dialog box.

Simulation Updates the Diagram

Simulink updates the block 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 at Edit Time

As you create a model, at any point you can have Simulink 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 at edit time, use one of these approaches:

  • In the Simulink Editor, select Simulation > Update Diagram.

  • Press Ctrl+D.

For example:

  1. Create the following model.

  2. In the Simulink Editor, select Display > Signals & Ports > Port 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 parameters dialog box, set Output data type to single.

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

  4. In the Simulink Editor, select Simulation > Update Diagram.

    The updated block diagram reflects the change that you made previously.

    In this example, Simulink infers a data type for the output of the Gain block. This is because you did not specify a data type for the block. The inferred data type inferred is single, because single precision is all that is necessary to simulate the model accurately, given that the precision of the block input is single.

Was this topic helpful?