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

Given a cell array C, return a cell array D with the following specifications:

1. D has the same size as the input C.

2. Each cell of D contains an empty (0x0) variable, the data type of which must match the data type of the original contents of the cell.


1. If C = {1, 2; zeros(2, 'single'), 'ABC'} then D = { [], []; zeros(0, 'single'), ''}.

2. If C = {true, rand(2), 'MATLAB'} then D = {true(0), [], ''}.

Note: cell arrays in the test suite only contain data types present in core MATLAB.

Solution Stats

54.17% Correct | 45.83% Incorrect
Last solution submitted on Nov 14, 2014

Solution Comments

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more