bdIsDirty
Determine whether model, subsystem, or library has unsaved changes
Syntax
Description
Examples
Check Model for Unsaved Changes
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.
Check Multiple Models for Unsaved Changes With Single Function Call
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
bd
— Name or handle of loaded model, subsystem, or library
numeric array | string array | character vector | cell array of character vectors
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
tf
— True or false result
1
| 0
| logical array
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
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)