MATLAB: Do I receive a “Error loading an object of class ‘proplistener'” warning when I LOAD the object that has an event listener in MATLAB 7.7 (R2008b)

MATLABmcosoop

I defined a class with an event listener and I created an object of that class. I saved that object to a Mat-file using the SAVE command, and then loaded it back into the workspace using the LOAD command. Upon loading the object, I receive this warning:
Warning: Error loading an object of class 'proplistener':
No matching constructor signature found.
Why do I get this warning and how do I resolve it?

Best Answer

The cause of the warning message is that while loading the object from the MAT-File, MATLAB was not able to attach the listener back to the object. If you check for 'proplist' property of the loaded object, you will find it is empty.
A listener object is attached to the object as long as the object remains in scope. Once you save the object it goes out of scope, so the listener for the saved object is destroyed. In order to keep the listener with the object as it is saved and loaded back into the workspace, you will need to define the LOADOBJ and SAVEOBJ functions in your class definition file.
Please refer to the Help documentation on SAVEOBJ and LOADOBJ by typing the following at the MATLAB Command Prompt:
doc saveobj
doc loadobj