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 335565

Submitted on 18 Oct 2013 by Greg

Correct

36Size
Leading solution size is 11.
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
 
%%
vec = [2 4 9 2];
y_correct = 2492;
assert(isequal(digits2Number(vec),y_correct))
out =
     []
out =
2
out =
24
out =
249
out =
2492
out =
        2492
2
Pass
 
%%
vec = [3 2]';
y_correct = 32;
assert(isequal(digits2Number(vec),y_correct))
out =
     []
out =
3
out =
32
out =
    32
3
Pass
 
%%
vec = [0 1 3 8 9 0];
y_correct = 13890;
assert(isequal(digits2Number(vec),y_correct))
out =
     []
out =
0
out =
01
out =
013
out =
0138
out =
01389
out =
013890
out =
       13890
4
Pass
 
%%
vec = [0 0 9 8 2];
y_correct = 982;
assert(isequal(digits2Number(vec),y_correct))
out =
     []
out =
0
out =
00
out =
009
out =
0098
out =
00982
out =
   982