Updating a Block Diagram

You can leave many attributes of a block diagram, such as signal data types and sample times, unspecified. The Simulink® product then infers the values of block diagram attributes based on block connectivity and attributes that you do specify, a process known as updating the diagram. The Simulink software tries to infer the most appropriate value for an attribute that you do not specify. If an attribute cannot be inferred, it halts the update and displays an error dialog box.

A model's block diagram is updated at the start of every simulation of a model. This assures that the simulation reflects the latest changes that you have made to a model. In addition, you can command the Simulink software to update a diagram at any time by selecting Edit > Update Diagram from the Model Editor's menu bar or context menu, or by pressing Ctrl+D. This allows you to determine the values of block diagram attributes inferred by the Simulink software immediately after opening or editing a model.

For example:

  1. Create the following model.

  2. Select Format > Port/Signal Displays > Port Data Types from the Model Editor's menu bar.

    The data types of the output ports of the Constant and Gain blocks are displayed. Note that the data type of both ports is double, the default value.

  3. Set the Signal Data Type parameter of the Constant block (see Constant) to single.

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

  4. Select Edit > Update Diagram from the Model Editor's menu bar or press Ctrl-D.

    The block diagram is updated to reflect the change that you made previously.

    Note that the Simulink software has inferred a data type for the output of the Gain block. This is because you did not specify a data type for the block. The 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's input is single.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS