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)

조회 수: 9 (최근 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