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

Correct

72Size
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
Code Input and Output
1
Pass
 
%%
str = '*rrr';
melody = '*-*-*-*';
assert(strcmp(parsons(str),melody))
[Warning: Out of range or non-integer values truncated during conversion to character.]
[> In ppval at 67
  In pchip at 87
  In parsons at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Out of range or non-integer values truncated during conversion to character.]
[> In ppval at 67
  In pchip at 87
  In parsons at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
2
Pass
 
%%
str = '*du';
melody = ['*   *'
          ' \ / '
          '  *  '];
assert(strcmp(parsons(str),melody))
[Warning: Out of range or non-integer values truncated during conversion to character.]
[> In ppval at 67
  In pchip at 87
  In parsons at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Out of range or non-integer values truncated during conversion to character.]
[> In ppval at 67
  In pchip at 87
  In parsons at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
3
Pass
 
%%
str = '*ruuddduur';
melody = ['      *            '
          '     / \           '
          '    *   *       *-*'
          '   /     \     /   '
          '*-*       *   *    '
          '           \ /     '
          '            *      '];
assert(strcmp(parsons(str),melody))
[Warning: Out of range or non-integer values truncated during conversion to character.]
[> In ppval at 67
  In pchip at 87
  In parsons at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Out of range or non-integer values truncated during conversion to character.]
[> In ppval at 67
  In pchip at 87
  In parsons at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
4
Pass
 
%%
str = '*rududdrudud';
melody = ['    *   *              '
          '   / \ / \             '
          '*-*   *   *     *   *  '
          '           \   / \ / \ '
          '            *-*   *   *'];
assert(strcmp(parsons(str),melody))
[Warning: Out of range or non-integer values truncated during conversion to character.]
[> In ppval at 67
  In pchip at 87
  In parsons at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Out of range or non-integer values truncated during conversion to character.]
[> In ppval at 67
  In pchip at 87
  In parsons at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
5
Pass
 
%%
str = '*rururddrdrdrd';
melody = ['        *-*                '
          '       /   \               '
          '    *-*     *              '
          '   /         \             '
          '*-*           *-*          '
          '                 \         '
          '                  *-*      '
          '                     \     '
          '                      *-*  '
          '                         \ '
          '                          *'];
assert(strcmp(parsons(str),melody))
[Warning: Out of range or non-integer values truncated during conversion to character.]
[> In ppval at 67
  In pchip at 87
  In parsons at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]
[Warning: Out of range or non-integer values truncated during conversion to character.]
[> In ppval at 67
  In pchip at 87
  In parsons at 2
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14
  In workspacefunc at 7]