Cody

# Problem 642. Convert a vector into a number

Solution 609497

Submitted on 1 Apr 2015 by LY Cao
• Size: 7
• This is the leading solution.
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
%% vec = [2 4 9 2]; y_correct = 2492; assert(isequal(digits2Number(vec),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In digits2Number (line 3) In evaluateCode', '/users/mss.system.W2ZHrv/+cody/verifyCode.m', 238)" style="font-weight:bold">cody.verifyCode>evaluateCode (line 238) In cody.verifyCode (line 43) In mls.internal.fevalJSON (line 14)]

2   Pass
%% vec = [3 2]'; y_correct = 32; assert(isequal(digits2Number(vec),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In digits2Number (line 3) In evaluateCode', '/users/mss.system.W2ZHrv/+cody/verifyCode.m', 238)" style="font-weight:bold">cody.verifyCode>evaluateCode (line 238) In cody.verifyCode (line 43) In mls.internal.fevalJSON (line 14)]

3   Pass
%% vec = [0 1 3 8 9 0]; y_correct = 13890; assert(isequal(digits2Number(vec),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In digits2Number (line 3) In evaluateCode', '/users/mss.system.W2ZHrv/+cody/verifyCode.m', 238)" style="font-weight:bold">cody.verifyCode>evaluateCode (line 238) In cody.verifyCode (line 43) In mls.internal.fevalJSON (line 14)]

4   Pass
%% vec = [0 0 9 8 2]; y_correct = 982; assert(isequal(digits2Number(vec),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In digits2Number (line 3) In evaluateCode', '/users/mss.system.W2ZHrv/+cody/verifyCode.m', 238)" style="font-weight:bold">cody.verifyCode>evaluateCode (line 238) In cody.verifyCode (line 43) In mls.internal.fevalJSON (line 14)]

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!