Filter löschen
Filter löschen

Unable to save file in simulink dictionary because not serializable

1 Ansicht (letzte 30 Tage)
Zeno Pavanello
Zeno Pavanello am 1 Dez. 2021
Beantwortet: Dhruv am 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

Antworten (1)

Dhruv
Dhruv am 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!

Kategorien

Mehr zu Structures finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by