Is the Model Workspace dirty?
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Is there a programatic way to determine if the model workspace is dirty, which is indicated by an asterisk next to "Model Workspace" in the model explorer?
0 commentaires
Réponse acceptée
Plus de réponses (1)
MG
le 8 Fév 2018
Modifié(e) : MG
le 8 Fév 2018
To determine if the model is dirty:
This means a model has changes that are unsaved.
x = get_param( gcs, 'ModelWorkspace' )
x.isDirty
or
bdIsDirty( gcs )
or
isDirtyOff = strcmp( get_param( gcs, 'Dirty' ), 'off' )
or
isDirtyOn = strcmp( get_param( gcs, 'Dirty' ), 'on' )
To set the dirty bit:
This will trick Simulink to think there are changes that are unsaved.
examples:
- if you want to save a changed view when there has been no material changes to the model; or
- you opened or closed some tabs and want to save that change in state when there has been no other material changes to the model.
x = get_param( gcs, 'ModelWorkspace' )
x.isDirty = 1;
or
set_param( gcs, 'Dirty', 'on' )
To save the model:
save_system( gcs )
To close the model:
close_system( gcs )
To save and close the model:
close_system( gcs, 1 )
0 commentaires
Voir également
Catégories
En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!