Cody

# Problem 1973. Reassign cell contents to empty variables, preserving cell content data type

Solution 374470

Submitted on 24 Dec 2013
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
%% C = {1}; D_correct = {[]}; assert(isequal(resetCell(C), D_correct))

2   Pass
%% C = {1, 2; zeros(2, 'single'), 'ABC'}; D_correct = { [], []; zeros(0, 'single'), '' }; assert(isequal(resetCell(C), D_correct))

3   Pass
%% C = {true, rand(2), 'MATLAB'}; D_correct = {true(0), [], ''}; assert(isequal(resetCell(C), D_correct))

4   Fail
%% C = {1, 2, 'ABC'; true, struct('A', 1), {0}}; D_correct = {[], [], ''; true(0), struct([]), {}}; assert(isequal(resetCell(C), D_correct))

Error: Unsupported class for conversion.

5   Pass
%% C = {1, single(3), @sin}; D_correct = {[], single([]), function_handle.empty}; assert(isequal(resetCell(C), D_correct))

6   Pass
%% C = {uint8(1), zeros(2, 'int16'), []}; D_correct = {zeros(0, 'uint8'), zeros(0, 'int16'), []}; assert(isequal(resetCell(C), D_correct))