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, use the Environment variables pane of the System Properties dialog box to set the USER environment variable (if it is not already defined). For Windows XP, access the Environment variables pane by clicking the Environment Variables button on the Advanced pane of the System Properties dialog box.

To display the System Properties dialog box, select Start > Settings > Control Panel to open the Control Panel. Double-click the System icon. To set the USER variable, enter USER in the Variable field and enter your login name in the Value field. Click Set to save the new environment variable. Then click OK to close the dialog box.

Model Properties Dialog Box

The Model Properties dialog box allows you to set various version control parameters and model callback functions. To display the dialog box, choose Model Properties from the File menu.

The dialog box includes the following panes.

Main Pane

The Main pane summarizes information about the current version of this model.

Callbacks Pane

The Callbacks pane lets you 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.

History Pane

The History pane allows you to enable, view, and edit this model's change history.

The History pane has two control groups: the Model information group and the Model History group.

Model Information Controls

The contents of the Model information control group depend on the state of the Read Only check box.

Read Only Check Box Selected.  When Read Only is selected, the dialog box shows the following fields grayed out.

Read Only Check Box Deselected.  When Read Only 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.

Model History Controls

The model history controls group contains a scrollable text field and an option list. The text field displays the history for the model in a scrollable text field. To change the model history, edit the contents of this field. The option list allows you to enable or disable the Simulink software model history feature. To enable the history feature, 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. Typically you would enter any changes that you have made to the model since the last time you saved it. This information is stored in the model's change history log. See Creating a Model Change History for more information. To disable the change history feature, select Never from the Prompt to update model history list.

Model Description Controls

This pane allows you to enter a description of the model. When 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, select When saving model from the Prompt to update model history list on the History pane on the Model Properties dialog box. The next time you save the model, a Log Change dialog box is displayed.

To add an item to the model's change history, enter the item in the Modified Comments edit field and click Save. 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, clear the Show this dialog box next time when save option.

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.

LastModifiedBy

User name of the person who last modified this model.

ModifiedBy

Person who last modified this model.

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

Date modified.

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.

Description

Description of model.

LastModifiedDate

Date last modified.

  


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