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

Learn moreOpportunities for recent engineering grads.

Apply TodayCorrect

104Size

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

Code Input and Output

1

Pass

%% assert(isequal(phoneword2number('1-800-COLLECT'),[1 8 0 0 2 6 5 5 3 2 8]))

phoneword = 1800COLLECT ascii = ABCDEFGHIJKLMNOPQRSTUVWXYZ score = Columns 1 through 16 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 Columns 17 through 26 7 7 7 8 8 8 9 9 9 9 phonenumber = 1 phonenumber = 18 phonenumber = 180 phonenumber = 1800 tf = 1 loc = 3 phonenumber = 18002 tf = 1 loc = 15 phonenumber = 180026 tf = 1 loc = 12 phonenumber = 1800265 tf = 1 loc = 12 phonenumber = 18002655 tf = 1 loc = 5 phonenumber = 180026553 tf = 1 loc = 3 phonenumber = 1800265532 tf = 1 loc = 20 phonenumber = 18002655328 ans = 1 8 0 0 2 6 5 5 3 2 8

2

Pass

%% assert(isequal(phoneword2number('1-800-CONTACTS'),[1 8 0 0 2 6 6 8 2 2 8 7]))

phoneword = 1800CONTACTS ascii = ABCDEFGHIJKLMNOPQRSTUVWXYZ score = Columns 1 through 16 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 Columns 17 through 26 7 7 7 8 8 8 9 9 9 9 phonenumber = 1 phonenumber = 18 phonenumber = 180 phonenumber = 1800 tf = 1 loc = 3 phonenumber = 18002 tf = 1 loc = 15 phonenumber = 180026 tf = 1 loc = 14 phonenumber = 1800266 tf = 1 loc = 20 phonenumber = 18002668 tf = 1 loc = 1 phonenumber = 180026682 tf = 1 loc = 3 phonenumber = 1800266822 tf = 1 loc = 20 phonenumber = 18002668228 tf = 1 loc = 19 phonenumber = 180026682287 ans = 1 8 0 0 2 6 6 8 2 2 8 7

3

Pass

%% assert(isequal(phoneword2number('1800FLOWERS'),[1 8 0 0 3 5 6 9 3 7 7]))

phoneword = 1800FLOWERS ascii = ABCDEFGHIJKLMNOPQRSTUVWXYZ score = Columns 1 through 16 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 Columns 17 through 26 7 7 7 8 8 8 9 9 9 9 phonenumber = 1 phonenumber = 18 phonenumber = 180 phonenumber = 1800 tf = 1 loc = 6 phonenumber = 18003 tf = 1 loc = 12 phonenumber = 180035 tf = 1 loc = 15 phonenumber = 1800356 tf = 1 loc = 23 phonenumber = 18003569 tf = 1 loc = 5 phonenumber = 180035693 tf = 1 loc = 18 phonenumber = 1800356937 tf = 1 loc = 19 phonenumber = 18003569377 ans = 1 8 0 0 3 5 6 9 3 7 7

4

Pass

%% assert(isequal(phoneword2number('800-BUSINESS'),[8 0 0 2 8 7 4 6 3 7 7]))

phoneword = 800BUSINESS ascii = ABCDEFGHIJKLMNOPQRSTUVWXYZ score = Columns 1 through 16 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 Columns 17 through 26 7 7 7 8 8 8 9 9 9 9 phonenumber = 8 phonenumber = 80 phonenumber = 800 tf = 1 loc = 2 phonenumber = 8002 tf = 1 loc = 21 phonenumber = 80028 tf = 1 loc = 19 phonenumber = 800287 tf = 1 loc = 9 phonenumber = 8002874 tf = 1 loc = 14 phonenumber = 80028746 tf = 1 loc = 5 phonenumber = 800287463 tf = 1 loc = 19 phonenumber = 8002874637 tf = 1 loc = 19 phonenumber = 80028746377 ans = 8 0 0 2 8 7 4 6 3 7 7