How do I find libraries with unsaved changes?

5 views (last 30 days)
Paul
Paul on 19 Aug 2024
Edited: akshatsood on 19 Aug 2024
I'm trying to build code via rtwbuild and am being met with the error Selected subsystem is linked to a library with unsaved changes. Please save the library.
I've been manually looking through the model and can't see anything with unsaved changes or broken links. And there seems to be no easy way to find the library with unsaved changes in question. Am I missing something or is there a way to find these libraries? I'm working with a very big model.

Answers (1)

akshatsood
akshatsood on 19 Aug 2024
Edited: akshatsood on 19 Aug 2024
Dear @Paul,
I understand that you are trying to locate libraries with unsaved changes. Here are some steps you can take:
Use the Model Explorer
  • Open the Model Explorer (View > Model Explorer).
  • In the Model Explorer, you can see all the libraries and models loaded in your session. Look for any libraries that have an asterisk (*) next to their name, which indicates unsaved changes.
Check the MATLAB Command Window
  • Sometimes, warnings or messages about unsaved changes are displayed in the MATLAB Command Window. Review the messages for any hints about which library might need saving.
Programmatically Check for Unsaved Changes
  • You can write a MATLAB script to iterate over all loaded libraries and check for unsaved changes.
loadedModels = find_system('type', 'block_diagram');
% check for unsaved changes
for i = 1:length(loadedModels)
modelName = loadedModels{i};
if bdIsLibrary(modelName)
if strcmp(get_param(modelName, 'Dirty'), 'on')
fprintf('Library with unsaved changes: %s\n', modelName);
end
end
end
I hope this helps.

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Tags

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!