Problem 1408. Given the name from the legend, return the handle
Write a function that will return the handle to the desired object. The input for this function will be a string which represents the objects name which has been created through a call to the "legend" function.
Example:
h_right = plot(1:2,1:2,'ro'); hold on; h_wrong = plot(1:3,1:3,'bx')
legend('Right','Wrong');
h_match = GetHandleByName('Right');
The test suite will test for: isequal(h_match,h_right)
Solution Stats
Problem Comments
-
2 Comments
Can you give us any hints? I tried findobj() but can't make progress!
You are on the right track with findobj(). The trick is what the call to "legend" does to the objects that make the solution very simple.
Solution Comments
Show commentsProblem Recent Solvers19
Suggested Problems
-
Create a matrix X, where each column is a shifted copy of the vector v
202 Solvers
-
Generate N equally spaced intervals between -L and L
865 Solvers
-
Unique values without using UNIQUE function
350 Solvers
-
The Answer to Life, the Universe, and Everything
528 Solvers
-
760 Solvers
More from this Author4
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!