Main Content

bdIsDirty

Determine whether model, subsystem, or library has unsaved changes

Description

tf = bdIsDirty(bd) returns whether the specified model, subsystem, or library has unsaved changes. Unsaved changes can include changes to the block diagram, configuration parameters, or properties.

example

Examples

collapse all

Open the example. Then, load the vdp and f14 models.

h1=load_system('vdp');
h2=load_system('f14');

Check whether the vdp model is dirty.

bdIsDirty(h1)
ans = logical
   0

The function returns a logical scalar, 0, which indicates that the model is not dirty.

Make a change to the vdp model.

set_param('vdp/Constant','Value','4')

Check whether the vdp model is dirty again.

bdIsDirty(h1)
ans = logical
   1

The function returns 1, which indicates that the model is dirty.

Open the example. Then, load the vdp and f14 models.

h1=load_system('vdp');
h2=load_system('f14');

Check whether the vdp and f14 models are dirty. Specify the models to check as a matrix of handles.

bdIsDirty([h1,h2])
ans = 1x2 logical array

   0   0

Alternatively, specify the models to check as a cell array of character vectors.

bdIsDirty({'vdp','f14'})
ans = 1x2 logical array

   0   0

The function returns the logical array [1 0], which indicates that:

  • The vdp model is dirty.

  • The f14 model is not dirty.

Input Arguments

collapse all

Name or handle of loaded model, subsystem, or library, specified as a numeric array, string array, character vector, or cell array of character vectors.

You cannot check whether blocks, such as Subsystem blocks, have unsaved changes. You can check whether referenced subsystems have unsaved changes. For more information, see Create and Use Referenced Subsystems in Models.

Data Types: double | char | string | cell

Output Arguments

collapse all

True or false result, returned as a 1 or 0 of data type logical.

  • 1 (true) — File has been modified in memory since it was loaded or last saved.

  • 0 (false) — File has no unsaved changes.

When multiple files are specified, the function returns a logical array with one entry for each file.

Version History

Introduced in R2017a