Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Switching from matlab 2013b version to 2020b version. Legend command with line handles

2 vues (au cours des 30 derniers jours)
Sajid Afaque
Sajid Afaque le 8 Sep 2021
Clôturé : Rik le 8 Sep 2021
hello All i switched from old 2013b matlab version to new 2020b matlab version.
In my existing scripts written originally in 2013b
now i think some issue with legend comand (legend on plots identified by handles), ill try to explain
Earlier (2013b),
ep_hdl=plot(0,0,'Visible','off','Color','k');
hleg2=legend([ep_hdl,ep_hd2], {'legend_name1','legend_name2'});
%ep_hd1 and ep_hd2 are line handles
here hleg2 used to return a handle of type double and below line i.e. leg_line used to contain line handles for both line
leg_line=findobj(hleg2,'type','Line');
Now in 2020b,
%when i use same code my leg_line is empty
leg_line=findobj(hleg2,'type','Line');
  2 commentaires
Rik
Rik le 8 Sep 2021
So this code was essentially retrieving the plot handles? That seems a strange way to do it, and I don't really see a good reason why this behavior existed in HG1 (or at least R2013b).
Why don't you describe what you actually want? That way you can keep focussed on reproducing the intended effect, instead of trying to fix single lines of code.
Rik
Rik le 8 Sep 2021
Please avoid posting duplicate questions.

Réponses (0)

Cette question est clôturée.

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by