Effacer les filtres
Effacer les filtres

Unable to save file in simulink dictionary because not serializable

1 vue (au cours des 30 derniers jours)
Zeno Pavanello
Zeno Pavanello le 1 Déc 2021
Réponse apportée : Dhruv le 24 Mai 2024
I am using the function addEntry to set the dictionary value "pangu" as a structure inside the dictionary "userDictionary". The structure "pangu" contains a filw which connects an S-function inside the simulink model to an external program, "pangu.ClientLibrary.ClientConnection@503a7990". When I try to use addEntry with this structure, I receive the following warning:
Warning: pangu.ClientLibrary.ClientConnection@503a7990 is not serializable > In Data.setDictionaryValue (line 15)
Of course the field which should contain the client connection results empty and the connection becomes not available, thus the impossibility to simulate the model.
Do you know of any way to overcome this "not serializable" problem?
Thank you

Réponses (1)

Dhruv
Dhruv le 24 Mai 2024
Hi Zeno,
A potential reason why you might be encountering this is because MATLAB does not support the serialization of database connection objects. This design choice prevents the saving and reloading of potentially disconnected database connections from ‘.MAT’ files.
In order to address the ‘not serializable’ warning and maintain your model's functionality, consider storing connection parameters separately and re-establishing the connection dynamically at runtime, rather than saving the connection object itself within the Simulink dictionary.
Hope this helps!

Catégories

En savoir plus sur Structures dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by