Follow up on "... why-do-i-g​et-warning​-cannot-lo​ad-an-obje​ct-of-clas​s-listener​-when-i-op​en-figure" (MATLAB R2015b)

7 次查看(过去 30 天)
See URL at end. This is a follow up question.
I get this error - warning, actually - but only after adding another toggle tool to my toolbar? There are already several toggles and pushbuttons and there was no issue until I added just one more? New control does not appear to be any different from the rest??
Is there a limit on the number of controls on a toolbar?
I have suppressed the warning messages but makes me nervous!
Here is the error (warning):
------------------------------
>> hgDataVars = load(filename, '-mat', '-regexp', '^hg[M]'); % This statement is from read.m
Warning: Cannot load an object of class 'proplistener':
No matching constructor signature found.
Warning: During load:
An invalid default object has been detected while loading a heterogeneous array of class event.proplistener. An empty array
of class event.proplistener will be returned.
------------------------------
This is the original question in answers:

回答(1 个)

Meet
Meet 2025-5-15
编辑:Meet 2025-5-15
Hi Dave,
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
Hope this helps resolves the issue
  1 个评论
Dave Watson
Dave Watson 2025-5-17
编辑:Dave Watson 2025-5-17
Thanks, perhaps I should have mentioned that the .FIG was created using GUIDE and the warning comes up well before ML calls my GUI handling code.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Object Save and Load 的更多信息

产品


版本

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by