Cody

Problem 1150. Polybius Square

Solution 2612941

Submitted on 25 Jun 2020
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   Fail
x = 'cody'; y_correct = [13 33 14 51]; assert(isequal(polybius(x),y_correct))

Error using str2num (line 35) Input must be a character vector or string scalar. Error in polybius (line 2) c = str2num([11:16 21:26 31:36 41:46 51 52 0]); Error in Test1 (line 3) assert(isequal(polybius(x),y_correct))

2   Fail
x = 'polybius'; y_correct = [34 33 26 51 12 23 43 41]; assert(isequal(polybius(x),y_correct))

Error using str2num (line 35) Input must be a character vector or string scalar. Error in polybius (line 2) c = str2num([11:16 21:26 31:36 41:46 51 52 0]); Error in Test2 (line 3) assert(isequal(polybius(x),y_correct))

3   Fail
x = 'i love matlab'; y_correct = [23 0 26 33 44 15 0 31 11 42 26 11 12]; assert(isequal(polybius(x),y_correct))

Error using str2num (line 35) Input must be a character vector or string scalar. Error in polybius (line 2) c = str2num([11:16 21:26 31:36 41:46 51 52 0]); Error in Test3 (line 3) assert(isequal(polybius(x),y_correct))

Suggested Problems

More from this Author62

Community Treasure Hunt

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

Start Hunting!