Problem 1408. Given the name from the legend, return the handle

Solution 226516

Submitted on 3 Apr 2013 by Claudio Gelmi
  • Size: 11
  • This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% h = plot(1:10,1:10,'--r'); hold on plot(1:10,0:9,'--b') legend('Test1','Test2') assert(isequal(h,GetHandleByName('Test1')))

2   Pass
%% close all plot(rand(10,1),rand(10,1),'b.') hold on h = plot(rand(10,1),rand(10,1),'Marker','.','Color',rand(1,3)); plot(rand(10,1),rand(10,1),'--m') legend('Test1','Test2','Test3') assert(isequal(h,GetHandleByName('Test2')))

Suggested Problems

More from this Author4

Community Treasure Hunt

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

Start Hunting!