Skip to Main Content Skip to Search
Product Documentation

Managing Model Versions

How Simulink Helps You Manage Model Versions

The Simulink software has these features to help you to manage multiple versions of a model:

Model File Change Notification

You can use the Simulink Preferences window to specify whether to notify if the model has changed on disk when updating, simulating, editing, or saving the model. This can occur, for example, with source control operations and multiple users.

To access the Simulink Preferences window,

The Model File Change Notification options are in the right pane. You can use the three independent options as follows:

Specifying the Current User

When you create or update a model, your name is logged in the model for version control purposes. The Simulink software assumes that your name is specified by at least one of the following environment variables: USER, USERNAME, LOGIN, or LOGNAME. If your system does not define any of these variables, the Simulink software does not update the user name in the model.

UNIX systems define the USER environment variable and set its value to the name you use to log on to your system. Thus, if you are using a UNIX system, you do not have to do anything to enable the Simulink software to identify you as the current user.

Windows systems, on the other hand, might define some or none of the "user name" environment variables that the Simulink software expects, depending on the version of Windows installed on your system and whether it is connected to a network. Use the MATLAB command getenv to determine which of the environment variables is defined. For example, enter

getenv('user')

at the MATLAB command line to determine whether the USER environment variable exists on your Windows system. If not, you must set it yourself.

On Windows, set the USER environment variable (if it is not already defined).

Managing Model Properties

You can use the Model Properties dialog box to view and edit model information (including some version control parameters), callback functions, history, and the model description. To open the dialog box,

Model Properties and Library Properties both include the tabs Main Model Information, Callbacks, History and Description. The controls in the shared tabs are described next on this page.

The dialog box includes the following panes.

Viewing Model Information

The Main pane summarizes information about the current version of this model, such as whether the model is modified, the Model Version, and Last Saved date. You can edit some of this information in the History tab, see Viewing and Editing Model Information and History.

Specifying Callbacks

Use the Callbacks pane to specify functions to be invoked at specific points in the simulation of the model.

In the left pane, select the callback. In the right pane, enter the name of the function you want to be invoked for the selected callback. See Creating Model Callback Functions for information on the callback functions listed on this pane.

Viewing and Editing Model Information and History

Use the History pane to view and edit model information, and to enable, view, and edit this model's change history in the lower Model history pane. To use the history controls see Creating a Model Change History.

Viewing Model Information.  When the Read Only check box is selected, you can view but not edit the following grayed out fields.

Editing Model Information.  Clear the Read Only check box to edit model information. When the check box is deselected, the dialog box shows the format strings or values for the following fields. You can edit all but the Created on field, as described.

Viewing and Editing the Model Description

Use the Description pane to enter a description of the model. You can view the model description by typing help followed by the model name at the MATLAB prompt. The contents of the Model description field appear in the Command Window.

Creating a Model Change History

You can create and store a record of changes to a model in the model itself. The Simulink software compiles the history automatically from comments that you or other users enter when they save changes to a model.

Logging Changes

To start a change history,

  1. Select File > Model Properties.

  2. In the Model Properties dialog box, select the History tab.

  3. Select When saving model from the Prompt to update model history list.

    This causes the Simulink software to prompt you to enter a comment when saving the model.

The next time you save the model, the Log Change dialog box prompts you to enter a comment.

For example you could describe changes that you have made to the model since the last time you saved it. To add an item to the model's change history, enter the item in the Modified Comments edit field and click Save. The information is stored in the model's change history log.

If you do not want to enter an item for this session, clear the Include "Modified Contents" in "Modified History" option.

To discontinue change logging, either:

Viewing and Editing the Model History Log

In the Model Properties dialog box you can view and edit the model history on the History tab.

The model history text field displays the history for the model in a scrollable text field. To change the model history, edit the contents of this field.

Version Control Properties

Version control information is stored as model parameters in a model. You can access this information from the MATLAB command line or from a MATLAB script, using the Simulink get_param command. The following table describes the model parameters used by Simulink to store version control information.

PropertyDescription

Created

Date created.

Creator

Name of the person who created this model.

Description

User-entered description of this model. Enter or edit a description on the Description tab of the Model Properties dialog box. You can view the model description by typing

help 'mymodelname' 

at the MATLAB command line.

LastModifiedBy

Name of the user who last saved the model.

LastModifiedDate

Date when the model was last saved.

ModifiedBy

Current value of the user name of the person who last modified this model. When you save, this information is saved with the file as LastModifiedBy.

ModifiedByFormat

Format of the ModifiedBy parameter. Value can be any string. The string can include the tag %<Auto>. The Simulink software replaces the tag with the current value of the USER environment variable.

ModifiedDate

Current value of the date-stamp. When you save, this information is saved with the file as LastModifiedDate.

ModifiedDateFormat

Format of the ModifiedDate parameter. Value can be any string. The string can include the tag %<Auto>. The Simulink software replaces the tag with the current date and time when saving the model.

ModifiedComment

Comment entered by user who last updated this model.

ModifiedHistory

History of changes to this model.

ModelVersion

Version number.

ModelVersionFormat

Format of model version number. Can be any string. The string can contain the tag %<AutoIncrement:#> where # is an integer. The Simulink software replaces the tag with # when displaying the version number. It increments # when saving the model.

LibraryVersion is a block parameter for a linked block. LibraryVersion is the ModelVersion of the library at the time the link was created.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

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