How to fix this Error? __ No constructor 'handle.listener' with matching signature found.
조회 수: 10 (최근 30일)
이전 댓글 표시
I have been getting the following error:
No constructor 'handle.listener' with matching
signature found.
Error in ut_subplot>ut_createListeners (line
427)
handle.listener(axlisth,findprop(axlisth(1),'OuterPosition'),
...
Error in ut_subplot>ut_addAxesToGrid (line 464)
ut_createListeners(p,handle(list));
Error in ut_subplot (line 398)
ut_addAxesToGrid(ax,nrows,ncols,row,col,inset);
Error in meo_plot (line 43)
ut_subplot(1,2,1);
Error in meofis_optimize (line 198)
meo_plot(new_pop, meo);
Error in meofis_batch (line 103)
meofis_optimize();
I am using MATLAB 2019a. The code isn't mine and is supposed to be from 2007. The code stops in the middle of drawing a graph in a gui.
The whole line where is stops -- including line 427 -- is:
list = [...
handle.listener(axlisth,findprop(axlisth(1),'OuterPosition'), ...
'PropertyPostSet',@ut_axesMoved); % <<---- PROBLEM LINE
handle.listener(axlisth,findprop(axlisth(1),'ActivePositionProperty'), ...
'PropertyPreSet',@ut_axesMoved);
handle.listener(axlisth,findprop(axlisth(1),'Parent'), ...
'PropertyPreSet',@ut_axesMoved);
handle.listener(axlisth,'AxisInvalidEvent',{@subplotlayoutInvalid,p});
handle.listener(handle(fig),'FigureUpdateEvent',{@subplotlayout,p})];
I did try the brute force solution of just commenting out the problem line, but the same type of error just showed up with the line right after it. Any help would be most welcome.
I have found this Ask/Answer here, but either I ddin't understant it or it isn't quite the same problem; I tried changing the names of the functions I was using in case they were the same as some that MATLAB uses, but I still got the same error.
Sadly, this question for a very similar error didn't get a reply:
댓글 수: 4
Mario Malic
2024년 9월 15일
So, all these lines of code are about assigning the function that will run when user interacts with the GUI. Those lines with errors that you see, is what MATLAB does if user panned or resized axes, which may not be important. If you really want to get that app working, I believe, "easiest" way is to make it yourself on the latest version.
These errors, may happen because these UI components (subplots, axes) worked differently 15 years ago.
Have you tried the link from the file exchange?
답변 (2개)
Walter Roberson
2024년 9월 15일
Try changing it to
list = [...
listener(axlisth,findprop(axlisth(1),'OuterPosition'), ...
'PropertyPostSet',@ut_axesMoved); % <<---- PROBLEM LINE
listener(axlisth,findprop(axlisth(1),'ActivePositionProperty'), ...
'PropertyPreSet',@ut_axesMoved);
listener(axlisth,findprop(axlisth(1),'Parent'), ...
'PropertyPreSet',@ut_axesMoved);
listener(axlisth,'AxisInvalidEvent',{@subplotlayoutInvalid,p});
listener(handle(fig),'FigureUpdateEvent',{@subplotlayout,p})];
댓글 수: 0
Anne Davenport
2024년 9월 16일
댓글 수: 3
Walter Roberson
2024년 9월 19일
Are you sure you are using R2019a ?
axlisth = axes();
aval = addlistener(axlisth, 'OuterPosition','PostSet',@ut_axesMoved);
works fine for me in R2019a.
(axlisth will be class 'matlab.graphics.axis.Axes')
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!