Library dictionary corrupted on re-load

18 views (last 30 days)
David Miller
David Miller on 12 Aug 2024
Answered: Himanshu on 13 Aug 2024
Why might this be happening? I've put some interface definitions in a data dictionary in a separate library. I then have pulled in the library block into a Simulink model. When I do so, it populates the expected entries in the "From Libraries" section in the Model Explorer, but once I save and reload via "load_system" I get the following errors and no access to the relevant variables from the library data dictionary.
Warning: Unable to load graph or digraph object because it was corrupted.
> In Simulink.LibraryDictionary.helperLoadOnDiscLinkageInfoFile
In Simulink.LibraryDictionary.getInstanceOfDependencyInfo
In load_system>i_load_system (line 44)
In load_system (line 20)
Warning: Unable to load graph or digraph object because it was corrupted.
> In Simulink.LibraryDictionary.helperLoadOnDiscLinkageInfoFile
In Simulink.LibraryDictionary.getInstanceOfDependencyInfo
In load_system>i_load_system (line 44)
In load_system (line 20)
From that point on, it seems to be broken unless I clear the cache, and refresh the data dicitonary via:
Simulink.DataDictionary.resetLibraryLinks;
Simulink.DataDictionary.refresh('mymodel.slx');
set_param('mymodel', SimulationCommand='update')
I can get around it for now, by adding the resetting and refreshing to my preload, but I'm concerned that if the interface grows that will slow down the loading of my model.

Answers (1)

Himanshu
Himanshu on 13 Aug 2024
Hi David,
This was likely a bug in the MATLAB R2023a. I had also faced this issue, and was able to resolve it by upgrading to MATLAB R2023b. As you have already mentioned, a workaround for this is to the run the command:
Simulink.LibraryDictionary.resetLibraryLinks
the documentation for which can be found below:
https://www.mathworks.com/help/simulink/slref/simulink.librarydictionary.resetlibrarylinks.html

Categories

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

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!