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

Solution 107601

Submitted on 6 Jul 2012 by Khaled Hamed

Correct

37Size
Leading solution size is 33.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%% example 1
C = {[1 2 3],[]};
 output = [  1     2     3
               NaN   NaN   NaN];
assert(isequalwithequalnans(your_fcn_name(C),output))

                    
2
Pass
 
%% example 2
C = {[1 2 3],8,[],[15  3]};
y_correct = [ 1     2     3
     8   NaN   NaN
   NaN   NaN   NaN
    15     3   NaN];
assert(isequalwithequalnans(your_fcn_name(C),y_correct))

                    
3
Pass
 
%%
tcell = {ones(1,4), [1 2 3 4 5], 1:8, 1, [],0};
y_correct = [   1     1     1     1   NaN   NaN   NaN   NaN
     1     2     3     4     5   NaN   NaN   NaN
     1     2     3     4     5     6     7     8
     1   NaN   NaN   NaN   NaN   NaN   NaN   NaN
   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN
     0   NaN   NaN   NaN   NaN   NaN   NaN   NaN];
assert(isequalwithequalnans(your_fcn_name(tcell),y_correct))

                    
4
Pass
 
%%
C = {[]}
assert(isempty(your_fcn_name(C)))
C =
    {[]}