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 191072

Submitted on 15 Jan 2013 by James

Correct

95Size
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
 
%%
inString1 = 'I am ready to try it - with punctuation and CAPS!';
outString1a = 'F xj obxav ql qov fq - tfqe mrkzqrxqflk xka ZXMP!';
assert(isequal(simpleDecoderRing(inString1,-3),outString1a ));
a =
  Columns 1 through 16
    88    89    90    65    66    67    68    69    70    71    72    73    74    75    76    77
  Columns 17 through 26
    78    79    80    81    82    83    84    85    86    87
b =
  Columns 1 through 16
   120   121   122    97    98    99   100   101   102   103   104   105   106   107   108   109
  Columns 17 through 26
   110   111   112   113   114   115   116   117   118   119
2
Pass
 
%%
inString1 = 'I am ready to try it - with punctuation and CAPS!';
outString1b = 'L dp uhdgb wr wub lw - zlwk sxqfwxdwlrq dqg FDSV!';
assert(isequal(simpleDecoderRing(inString1,3),outString1b ));

                    
3
Pass
 
%%
inString2 = 'Dick Tracy is often associated with decoder rings.';
outString2a = 'Lqks Bzikg qa wnbmv iaawkqibml eqbp lmkwlmz zqvoa.';
assert(isequal(simpleDecoderRing(inString2,-18),outString2a ));
a =
  Columns 1 through 16
    73    74    75    76    77    78    79    80    81    82    83    84    85    86    87    88
  Columns 17 through 26
    89    90    65    66    67    68    69    70    71    72
b =
  Columns 1 through 16
   105   106   107   108   109   110   111   112   113   114   115   116   117   118   119   120
  Columns 17 through 26
   121   122    97    98    99   100   101   102   103   104
4
Pass
 
%%
inString2 = 'Dick Tracy is often associated with decoder rings.';
outString2b = 'Zeyg Pnwyu eo kbpaj wookyewpaz sepd zaykzan nejco.';
assert(isequal(simpleDecoderRing(inString2,22),outString2b ));