How to fix this Error? __ No constructor 'handle.listener' with matching signature found.
14 次查看(过去 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!