Cody

# Problem 405. Back to basics 15 - classes

Solution 1870249

Submitted on 10 Jul 2019 by Andrew Gorrie
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 = @sin; y_correct = 'function_handle'; assert(isequal(input_class(x),y_correct))

a = struct with fields: name: 'x' size: [1 1] bytes: 32 class: 'function_handle' global: 0 sparse: 0 complex: 0 nesting: [1×1 struct] persistent: 0 ans = 'function_handle'

2   Pass
x = {1}; y_correct = 'cell'; assert(isequal(input_class(x),y_correct))

a = struct with fields: name: 'x' size: [1 1] bytes: 120 class: 'cell' global: 0 sparse: 0 complex: 0 nesting: [1×1 struct] persistent: 0 ans = 'cell'

3   Pass
x = [1]; y_correct = 'double'; assert(isequal(input_class(x),y_correct))

a = struct with fields: name: 'x' size: [1 1] bytes: 8 class: 'double' global: 0 sparse: 0 complex: 0 nesting: [1×1 struct] persistent: 0 ans = 'double'

4   Pass
x = uint32(1); y_correct = 'uint32'; assert(isequal(input_class(x),y_correct))

a = struct with fields: name: 'x' size: [1 1] bytes: 4 class: 'uint32' global: 0 sparse: 0 complex: 0 nesting: [1×1 struct] persistent: 0 ans = 'uint32'

5   Pass
x = 'abcd'; y_correct = 'char'; assert(isequal(input_class(x),y_correct))

a = struct with fields: name: 'x' size: [1 4] bytes: 8 class: 'char' global: 0 sparse: 0 complex: 0 nesting: [1×1 struct] persistent: 0 ans = 'char'

### Community Treasure Hunt

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

Start Hunting!