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 104804

Submitted on 29 Jun 2012

Incorrect

76Size
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
Fail
 
%% example 1
C = {[1 2 3],[]};
 output = [  1     2     3
               NaN   NaN   NaN];
assert(isequalwithequalnans(your_fcn_name(C),output))
Error: Index exceeds matrix dimensions.
2
Fail
 
%% 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))
Error: Assertion failed.
3
Fail
 
%%
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))
Error: Assertion failed.
4
Fail
 
%%
C = {[]}
assert(isempty(your_fcn_name(C)))
Error: Index exceeds matrix dimensions.