Library dictionary corrupted on re-load

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

回答(1 个)

Himanshu
Himanshu 2024-8-13
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

类别

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

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by