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 172430

Submitted on 4 Dec 2012

Incorrect

50Size
Leading solution size is 21.
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
Fail
 
%%
n = 3;
m = make_diamond(n);
assert(strcmp(char(0), m(2,2)))
assert(all(find(double(make_diamond(3)) == 0) == [1 3 5 7 9]') == 1)
Error: Assertion failed.
2
Pass
 
%%
n = 9;
m = make_diamond(n);
assert(strcmp(char(0), m(5,5)))
ans =
   * *
  *   *
 *     *
*       *
*       *
 *     *
  *   *
   * *
3
Pass
 
%%
n = 35;
m = make_diamond(n);
assert(strcmp(char(0), m(15,15)))
ans =
                * *
               *   *
              *     *
             *       *
            *         *
           *           *
          *             *
         *               *
        *                 *
       *                   *
      *                     *
     *                       *
    *                         *
   *                           *
  *                             *
 *                               *
*                                 *
*                                 *
 *                               *
  *                             *
   *                           *
    *                         *
     *                       *
      *                     *
       *                   *
        *                 *
         *               *
          *             *
           *           *
            *         *
             *       *
              *     *
               *   *
                * *