Problem 971. Siblings of a graphics object

Solution 2323743

Submitted on 21 May 2020
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
close all hIn = line; hOut = line; assert(isequal(siblings(hIn),hOut))

2   Pass
close all hIn = patch; hOut = line; assert(isequal(siblings(hIn),hOut))

3   Pass
close all hIn = line; hOut = sort([line; line]); assert(isequal(siblings(hIn),hOut))

4   Pass
close all hIn = subplot(1,2,1); hOut = subplot(1,2,2); assert(isequal(siblings(hIn),hOut))

5   Pass
close all hIn = figure; hOut = figure; assert(isequal(siblings(hIn),hOut))

6   Fail
close all hIn = line; hOut = []; assert(isequal(siblings(hIn),hOut))

Assertion failed.

7   Fail
close all hIn = 0; hOut = []; assert(isequal(siblings(hIn),hOut))

Dot indexing is not supported for variables of this type. Error in siblings (line 2) hOut = setdiff(hIn.Parent.Children, hIn); Error in Test7 (line 5) assert(isequal(siblings(hIn),hOut))

Suggested Problems

More from this Author52

Community Treasure Hunt

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

Start Hunting!