Is there a better way to do the following undocumented thing

I have a piece of 3rd party code with the following lines, which worked as needed in R2013b,
hgp = findpackage('hg');
axesC = findclass(hgp,'axes');
LimListener = handle.listener(imAxes,...
[axesC.findprop('XLim') axesC.findprop('YLim')],...
'PropertyPostSet',@localLimitListener);
This code uses undocumented functions findpackage and findclass . Now that I've upgraded to R2014b, their behavior has changed and the code no longer works properly. In particular, findpackage('hg') now just returns empty, [] .
Was there a better way to have implemented this in R2013b, one which avoids undocumented MATLAB and which will continue to work in R2014b?

2 Commenti

What does findpackage do? It seems obvious from the title, but not so obvious why it is needed over and above just using an import instruction.
Adam,
Since findpackage is undocumented, I cannot know what it does or how it is different from import(). But in my Answer, I think I've found it to be unnecessary altogether.

Accedi per commentare.

 Risposta accettata

Matt J
Matt J il 19 Nov 2014
Modificato: Matt J il 19 Nov 2014
I think I figured it out. It can all be condensed to
LimListener = addlistener(imAxes,{'XLim','YLim'},'PostSet',@localLimitListener);

Più risposte (0)

Richiesto:

il 19 Nov 2014

Commentato:

il 19 Nov 2014

Community Treasure Hunt

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

Start Hunting!

Translated by