Ignoring Listeners when loading an object?
Show older comments
I have a class object that has listeners linked to it by an object manager class. The listeners are not necessary or instrinsic to the objects themselves, the manager just uses it to keep track of changes to the objects. I want to be able to save and re-load the objects, however, everytime I do this I get spammed with warnings such as
An invalid default object has been detected while loading a heterogeneous array of
class event.listener. An empty array of class event.listener will be returned.
And
Warning: While loading an object of class 'listener':
No constructor 'event.listener' with matching signature found.
Other than that the load seems to succeed. I have tried defining both a saveobj and loadobj method for the class where the saveobj method returns a struct with property values and the load object created a default class obj with a class constructor with no arguments and then fills in the properties from the struct but I still get these errors.
Short or doing something with warnstruct and lastwarn to hide the messags, how do resolve this?
1 Comment
Pierre Harouimi
on 5 Jan 2024
Edited: Matt J
on 5 Jan 2024
Answers (0)
Categories
Find more on Construct and Work with Object Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!