How do I find libraries with unsaved changes?

5 次查看(过去 30 天)
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.

回答(1 个)

akshatsood
akshatsood 2024-8-19
编辑:akshatsood 2024-8-19
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.

类别

Help CenterFile Exchange 中查找有关 Programmatic Model Editing 的更多信息

标签

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by