In Simulink®, you can manage multiple versions of a model using these techniques:
Use projects to manage your project files, connect to source control, review modified files, and compare revisions. See Project Management.
Use model file change notifications to manage work with source control operations and multiple users. See Model File Change Notification.
Simulink.MDLInfo to extract information
from a model file without loading the block diagram into memory. You can use
MDLInfo to query model version and Simulink version, find the names of referenced models without loading the model into
memory, and attach arbitrary metadata to your model file.
You can use a Simulink preference to specify whether to notify you if the model has changed on disk. You can receive this notification when updating or simulating the model, first editing the model, or saving the model. The model can change on disk, for example, with source control operations and multiple users.
In the Simulink Editor, on the Modeling tab, select Environment > Simulink Preferences. In the Model File pane, under Change Notification, you can select these options:
If you select First editing the model, the file has changed on disk, and the block diagram is unmodified in Simulink:
Any interactive operation that modifies the block diagram (for example, adding a block) causes a warning to appear.
Any command-line operation that modifies the block diagram (such as a call to
set_param) causes a warning to appear.
If you select Saving the model, and the file has changed on disk:
Saving the model in the Simulink Editor causes a message to appear.
save_system function reports an error, unless you use
To programmatically check whether the model has changed on disk since it was loaded, use
For more options that help you work with source control and multiple users, see Project Management.
You can use the Property Inspector to view and edit model version properties, description, and callback functions. To open the Property Inspector, in the Modeling tab, under Design, click Property Inspector. Model properties or, if you are in a library model, library properties, appear in the Property Inspector when nothing is selected at the top level of a model.
When you create or update a model, your name is logged in the model. Simulink assumes that your name is specified by at least one of the
LOGNAME environment variables. If your system does not define any of
these variables, Simulink 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 in to your system. Thus, if you are using a UNIX system, you do not have to take further action for Simulink to identify you as the current user.
Windows® systems can define environment variables for user name that Simulink expects, depending on the version of Windows installed on your system and whether it is connected to a network. Use the
getenv to determine which of the environment
variables is defined. For example, at MATLAB Command Window, enter:
This function determines whether the
USER environment variable
exists on your Windows system. If it does not, set it.
The Info tab summarizes information about the current version of the model, such as modifications, version, and the last saved date. You can view and edit model information and enable, view, and edit the model change history.
Use the Description section to enter a description of the model.
You can then view the model description by entering
followed by the model name at the MATLAB Command Window.
Version number for this model. The major model version is incremented by the number of releases passed since the model was last saved. The minor model version is reset to zero for every new release of Simulink and is incremented by one each time you save the model within the same release.
Name of the person who created this model based on the value of the
USER environment variable when the model is created.
Date and time this model was created. Do not change this value.
Last saved by
Name of the person who last saved this model based on the value of the
USER environment variable when the model is saved.
Last saved on
Date that this model was last saved, based on the system date and time.
You can view the source file location, set the model compression level, specify where to save model design data, and define callbacks in the Properties tab of the model properties.
Library properties also enable you to specify the mapping from old library blocks to new library blocks. For information on using forwarding tables for this purpose, see Maintain Compatibility of Library Blocks Using Forwarding Tables.
Set SLX Compression Level. In the Properties tab of the Property Inspector, you can select one of three SLX Compression options:
None applies no compression during the save
Normal, the default, creates the smallest file
Fastest creates a smaller file size than you would
get by selecting
None, but provides a faster save time
To set the compression level programmatically, use
You can reduce your Git™ repository size by saving Simulink models without compression. Turning off compression results in larger SLX files on disk, but reduces repository size.
To use this setting with new SLX files, create your models using a model template
with SLX Compression set to
Create Template from Model. For existing SLX files, set
the compression and then save the model.
Define Location of Design Data. Use the External Data section to specify the location of the design data that your model uses. You can define design data in the base workspace or in a data dictionary. See Migrate Single Model to Use Dictionary.
Callbacks. Use the Callbacks section to specify functions to invoke at specific points during the simulation of the model. Select the callback from the list. In the box, enter the function you want to invoke for the selected callback. For information on these callbacks, see Create Model Callbacks.
Some version information is stored as model parameters in a model. You can access this
information programmatically using the Simulink
The table describes the model parameters used by Simulink to store version information.
Name of the person who created this model.
User-entered description of this model. In the Property Inspector, on the Info tab, enter or edit a description for the model in the Description box. To view the model description at the MATLAB Command Window, enter:
If the value of this parameter is
Absolute path where the model is saved.
Name of the user who last saved the model.
Date when the model was last saved.
Names and attributes of arbitrary data associated with the model. For
more details, see
Format of the
Format used to generate the value of the
The major model version is incremented by the number of releases passed since the model was last saved. The minor model version is reset to zero for every new release of Simulink and is incremented by one each time you save the model within the same release.
The value contains the model format version as
To find the
current absolute path of the model, use
Indicates whether the model has been saved since it was loaded.
Simulink version that last saved the model, e.g.,
Whether the model has access to design data and configuration sets in the
base workspace, specified as
LibraryVersion is a block parameter for a linked block.
LibraryVersion is the
ModelVersion of the library at
the time the link was created.
For source control version information, see Project Management.