Cody

Problem 45583. Determined if input object array is heterogeneous

Solution 2382058

Submitted on 26 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
x = [figure; axes; rectangle]; y_correct = true; assert(isequal(isheterogeneous(x),y_correct))

`  `
2   Fail
x = [matlab.net.http.io.FileProvider, matlab.net.http.io.JSONProvider]; y_correct = true; assert(isequal(isheterogeneous(x),y_correct))

Unrecognized method, property, or field 'Parent' for class 'matlab.net.http.io.FileProvider'. Error in isheterogeneous (line 3) if tf && length(x) == 2 && x(1).Parent == x(2).Parent % cheating Error in Test2 (line 3) assert(isequal(isheterogeneous(x),y_correct))

3   Pass
x = ""; y_correct = false; assert(isequal(isheterogeneous(x),y_correct))

4   Pass
x = rand(5, 4); y_correct = false; assert(isequal(isheterogeneous(x),y_correct))

5   Pass
x = {table(), 123, digraph()}; y_correct = false; assert(isequal(isheterogeneous(x),y_correct))

6   Pass
x = [figure; figure]; y_correct = false; assert(isequal(isheterogeneous(x),y_correct))

`  `
`  `
7   Pass
x = []; y_correct = false; assert(isequal(isheterogeneous(x),y_correct))