How to fix this Error? __ No constructor 'handle.listener' with matching signature found.
60 views (last 30 days)
Show older comments
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 Comments
Mario Malic
on 15 Sep 2024 at 10:25
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?
Answers (2)
Walter Roberson
on 15 Sep 2024 at 19:06
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 Comments
Anne Davenport
on 16 Sep 2024 at 18:26
3 Comments
Walter Roberson
on 19 Sep 2024 at 23:37
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')
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!